what is the difference between static block and static
method
Answer Posted / kishore reddy
static{} blocks are executed on its own as soon as the
program starts. i.e before the main method is called where
as static() is called ONLY from another static method ie
main method.
static() has several restrictions:
1. Can ONLY call other static ()
2. MUST ONLY access static data
3. cant refer to super or this
| Is This Answer Correct ? | 14 Yes | 2 No |
Post New Answer View All Answers
What is java beans?
How many bytes is double?
How many bits is a 64 bit byte?
Why is java called java?
Explain listiterator and methods in listiterator?
What is an object class?
explain what is transient variable in java?
What is a class reference?
Why pointers are not used in java?
Why are parameters used in functions?
Define iterator and methods in iterator?
What are the important features of Java 11 release?
What is the purpose of extern variable?
Write a code to show a static variable?
Is int a class in java?