- will print Class One method
- will print Class Two method
- compiles fine but print nothing
- Compilation Error
- None of these
Answer: Option 2 First execute static block, then statement block and then constructor.
1 Answers 1 viewsAnswer: Option 2 You can not override private method , private method is not availabe in subclass . In this case printName() method a class A is not overriding by...
1 Answers 87 viewsAnswer: Option 3 The overriding method can throw any unchecked (runtime) exception, regardless of exception thrown by overridden method. NullPointerException is RuntimeException so compiler will not complain.
1 Answers 1 viewsAnswer: Option 1 The options B, C and D are incorrect options as in Java we can declare an abstract class comprising of abstract and non-abstract methods that will not...
1 Answers 1 viewsAnswer: Option 1 Overriding in Java simply means that the particular method would be called based on the run time type of the object and not on the compile time...
1 Answers 1 viewsAnswer: Option 3 The program will compile and execute successfully as you can declare methods with same name in an interface and the method of either interface can be used,...
1 Answers 1 viewsAnswer: Option 3 We cannot reduce the visibility of the inherited method from super class. If the overridden or hidden method is public, then the overriding or hiding method must...
1 Answers 6 views