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 are "class access modifiers" in Java?
What is the difference between stream and buffer?
What is volatile data type?
Tell me the Importent classes in net package?
What is string variable?
How do you define a set in java?
Describe 2 different ways to concatenate two strings.
What are heap memory and stack memory and what are memory tables.
What is jvm? Why is java called the platform independent programming language?
What is preflight request?
What does \ mean in regex?
What is the advantage of functional interface in java 8?
What is the default access specifier for variables and methods of a class?
What are the types of inner classes (non-static nested class) used in java?
Does java set allow duplicates?