Unreachable statements in Java refers to those sets of statements that won’t get executed during the execution of the program are called Unreachable Statements. These… Read More
Tag Archives: final keyword
final: In Java, final is a modifier that is used for class, method, and variable also. When a variable is declared with the final keyword,… Read More
A variable provides us with named storage that our programs can manipulate. There are two types of data variables in a class: Instance variables :… Read More
class Base { public final void show() { System.out.println("Base::show() called"); } } class Derived extends Base { public void show() { System.out.println("Derived::show() called"); } }… Read More
class Main { public static void main(String args[]){ final int i; i = 20; i = 30; System.out.println(i); } } (A) 30 (B) Compiler Error… Read More
Output of following Java program class Main { public static void main(String args[]){ final int i; i = 20; System.out.println(i); } } (A) 20 (B)… Read More
What is the use of final keyword in Java? (A) When a class is made final, a subclass of it can not be created. (B)… Read More