- Value-A
- Name-B
- Value-A Name-B
- Compilation fails - private methods can't be override
- None of these
Answer: 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 printName() method of class B. printName() method of class B different method. So you can call printName() method of class B.
Answer: Option 2 First execute static block, then statement block and then constructor.
1 Answers 1 viewsAnswer: Option 2 Let'
1 Answers 1 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 2 Let'
1 Answers 4 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