Saturday 8 April 2017

Static Members (Static Methods )

Static Members (Methods, Variables, Static Block and Class)

Static Method


In JAVA, Variables can be declared with the "static" keyword.

Syntax: <class-name>.<method-name>
Example: Student.getName();

A static method can only call only other static methods, i.e. they cannot call a non-static method from it.

A static method can be accessed directly by the class name and doesn’t need any object to all it.

A static method cannot refer to this or super keywords in anyway.

A static method can access only static data. It can not access non-static data (instance variables)

Static Members (Static variables / Class variables)

Static Members (Methods, Variables, Static Block and Class)

Static Variable

In JAVA, Variables can be declared with the "static" keyword.
Example: static int x = 0;
When a variable is declared with the keyword "static", its called a class variable. All instances share the same copy of the variable. A class variable can be accessed directly with the class, without the need to create an instance.
So a static variable is common to all the objects and can be accessed without using a particular object.
They belong to the class rather than an object, hence they are also known as class variables.

Monday 18 May 2015

HELLO, COFFEE ADDICTS :D

Okay…lets see..Hello everyone or no-one(don’t know if this blog will ever get a visitor other than me :P) anyway, this would be my very first post…(excited), ever since i was a child, i wanted to share my experiences with others and so, i guess, making my very own blog was the next logical step. Here goes my introduction.
My name is Aman Sethi and i just entered the IT industry as a java software developer.  i hope to become a professional one day and gain enough knowledge to build my very own company. its a long way to go, but i have taken the first step, so yeah, lets see where that takes me to.
The first ever programming language i used, was at my school lab,in the early 90’s called “Logo Programming Language”, ring any bells? for those of you who don’t know about it, well this language had a turtle(cursor) that moved around based on the commands given to it like “>right 90″ to make it turn right etc. basically it did nothing but draw some basic shapes, but still as a child, somehow, i was very fascinated by it and i think, its this fascination that made me into a java developer.
Through this blog i hope to guide budding developers like me, to help them with their development work and enable them to become professional developers.
Well enough with the chit-chat, let get this started ,See you next time.
-Aman Sethi

P.S. Upcomming tutorials include: Spring Batch,Hibernate, Struts, Program Designing, Advance java (servlets,jsp,socket,etc) and much more.
“The best thing about a boolean is even if you are wrong, you are only off by a bit.”