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 local variable and instance variable?
How many threads does a core java have?
What are the different collection views provided by maps?
What is the definition of tree ?
What do you mean by boolean?
Is sizeof a keyword in java programming?
How many static init can you have?
What is a nested list?
What is multi level inheritance in java?
What are synchronized methods and synchronized statements in java programming?
How can you traverse a linked list in java?
Is an integer an object?
What does arrays sort do in java?
What are reference variables in java?
Java is Pass by Value or Pass by Reference?