What is difference between static method and static
variable?
Answer Posted / priyabrata patro
first let us see what is method and variable.
method is nothing but a functionality which is collection of statement.But variable is a container which contains data.
second is what is the usage of static keyword.
By using static keyword you can save memory , i mean if you declare one non static member than while creating object it will occupie memory but once you have declared one member as a static , it will not allocate memory number times rather than once.
ok , now let us find out about our question.
static mehod contains statements and where exactly you can use static variable.And it can be invoked by any methods only.
And static variable contains data which can be modified by any methods.And it can be used by method and also other variable. And one main thing about static variable is you can declare a static member as local variable.
Sorry , i could not be able to declare about static . ok , if you want to know more than contact me in this mail id priyabrata.try@gmail.com
| Is This Answer Correct ? | 13 Yes | 1 No |
Post New Answer View All Answers
What is the difference between serializable and externalizable interface?
What purpose do the keywords final, finally, and finalize fulfill?
How big is a boolean?
What is unicode with example?
Are the imports checked for validity at compile time? Will the code containing an import such as java.lang.abcd compile?
What are the differences between string, stringbuffer and stringbuilder?
List types of storage classes in java?
What will happen when using pass by reference in java?
What is passing by reference in java?
How can you traverse a linked list in java?
What are the skills required for core java?
What is the difference between char and char *?
What are the three parts of a lambda expression?
make a method which any number and any type of argument and print sum of that arguments.....
Can we force garbage collector to run ?