What is non static block in java

Answer Posted / mohan

In between {....}whatever u can write that consider as
Instance block or Non static block.

Ex:
class hai{

//Instance block
{
System.out.println("hi i'm Instance block....");
}

//Static block
static{
System.out.println("hi i'm Static block....");
}

}

Is This Answer Correct ?    8 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Write a program to show whether a graph is a tree or not using adjacency matrix.

811


how we can create packages in java?

692


What will happen if a thrown exception is not handled?

740


Explain try and catch keywords in java?

837


'A class is a template for an object' explain this statement.

721






Can a final variable be initialized in constructor?

677


What is the collections api?

753


How would you format a date in java? I.e. In the ddmmyyy format?

1070


What are three types of loops in java?

781


Is this valid in java ? Can we instantiate interface in java?

732


What is type safety in java?

695


What is Java Reflection API? Why it’s so important to have?

802


What is main string [] args?

713


How do you check if a character in a string is a digit or letter?

737


Explain method local inner classes ?

765