Search Interview Questions | ![]() ![]() Click here and help us by providing the answer. ![]() Click Correct / Improve and please let us know. |
|
| |||||||||||
Core Java - Interview Questions and Answers for 'Instance initialization blocks' - 2 question(s) found - Order By Newest | |||||||||||
| |||||||||||
Ans. Constructor has the same name as class name whereas instance initialization block just have a body without any name or visibility type. instance initialization blocks are useful if we want to have some code run regardless of which constructor is used or if we want to do some instance initialization for anonymous classes. | |||||||||||
![]() | |||||||||||
![]() ![]() ![]() ![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
| |||||||||||
Ans. Yes, It's an instance initialization block. | |||||||||||
![]() | |||||||||||
![]() ![]() ![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() a. Transient b. Final c. Explicit d. Synchronized | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() 1. new OuterClass().new InnerClass(); 2. new OuterClass.InnerClass(); | |||||||||||
![]() | |||||||||||
![]() String[] strArray = new String[2]; strArray = new String[5]; | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
| |||||||||||
| |||||||||||