filmov
tv
Static and Instance Blocks in java| Core Java interview questions - IIQs

Показать описание
static and instance blocks in java| Core Java interview questions - IIQs
25 Core java questions framed around static and instance blocks in java for java developers how are attending the interviews
Here are few interview questions around static and instance blocks:
1. What is static block?
2. What is instance block?
3. What are the Similarities & differences between static block and instance block?
4. What are the Similarities and Differences between static block and static method?
5. When the static block is getting executed? (OR)
6. What is the order of execution static block, static/main method?
7. When the instance block is getting executed? (OR)
9. What is the order of execution instance block, main method, constructor?
10. Can we write more than one static block in a class? (OR)
10) How many static blocks we can write in a class?
11) Can we write more than one instance block in a class? (OR)
12) How many instance blocks we can write in a class?
13) In which position/place we can write the static/instance blocks in a java class?
14) What is the order of static/instance block execution in a java programme?
15) Can we override constructor values in instance block? No
16) Can we override main method values in a static block? No
17) Can we create instance of the class in its static block? Yes
18) How can we create objects if we make the constructor private? Yes
19) How can we run a java program without making any object? Yes
20) Is it possible to compile and run a Java program without writing main?
21) Can we initialize member variables within static block?
#JavaBeam #StaticBlocks #JavaInterview #JAVA
25 Core java questions framed around static and instance blocks in java for java developers how are attending the interviews
Here are few interview questions around static and instance blocks:
1. What is static block?
2. What is instance block?
3. What are the Similarities & differences between static block and instance block?
4. What are the Similarities and Differences between static block and static method?
5. When the static block is getting executed? (OR)
6. What is the order of execution static block, static/main method?
7. When the instance block is getting executed? (OR)
9. What is the order of execution instance block, main method, constructor?
10. Can we write more than one static block in a class? (OR)
10) How many static blocks we can write in a class?
11) Can we write more than one instance block in a class? (OR)
12) How many instance blocks we can write in a class?
13) In which position/place we can write the static/instance blocks in a java class?
14) What is the order of static/instance block execution in a java programme?
15) Can we override constructor values in instance block? No
16) Can we override main method values in a static block? No
17) Can we create instance of the class in its static block? Yes
18) How can we create objects if we make the constructor private? Yes
19) How can we run a java program without making any object? Yes
20) Is it possible to compile and run a Java program without writing main?
21) Can we initialize member variables within static block?
#JavaBeam #StaticBlocks #JavaInterview #JAVA