What is static variable and static method?
Answer Posted / viral
class A
{ static int a;
}
class StaticDemo
{ public static void main(String args[])
{ A obj1 = new A();
A obj2 = new A();
}
}
In such a case, objects obj1 and obj2 will not have
different copies of variable a. Both objects will refer to
the same "a". In simpler words, copy of "a" is not created.
If "a" was not static, then obj1 and obj2 would hold
different copies of "a".
Is This Answer Correct ? | 14 Yes | 0 No |
Post New Answer View All Answers
Which are the two subclasses under exception class?
Is boolean a data type in java?
What do u mean by variable?
What is the file type?
How does map works in java?
What is the difference between char and char *?
How do you check if two given string are anagrams?
What is java string pool?
Explain about version control?
Write a java program to find the route that connects between Red and Green Cells. General Rules for traversal 1. You can traverse from one cell to another vertically, horizontally or diagonally. 2. You cannot traverse through Black cells. 3. There should be only one Red and Green cell and at least one of each should be present. Otherwise the array is invalid. 4. You cannot revisit a cell that you have already traversed. 5. The maze need not be in the same as given in the above example
What are scalar data types?
What language is an assembler written in?
Is arraylist dynamic in java?
What is a literal coding?
Is java platform independent?