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
Can we create an object of static class in java?
What is floor math?
What is a treeset in java?
What is Session reduplication and how its done?
How do you escape sequences in java?
What is the difference between JDK and JVM?
What restrictions are placed on method overriding in java programming?
What is your platform’s default character encoding?
Which container method is used to cause a container to be laid out and redisplayed in java programming?
What are the basic interfaces of java collections framework?
Can a string be null?
Explain jdk, jre and jvm?
What java ide should I use?
Can we change the scope of the overridden method in the subclass?
What is arguments in java?