Predict the output of following Java program // Note static keyword after import. import static java.lang.System.*; class StaticImportDemo { public static void main(String args[])… Read More
Category Archives: Java Quiz
Predict the output of the following program. class Test { int count = 0; void A() throws Exception { try { count++; try… Read More
Predict the output of the following program. class Test { public static void main(String[] args) { String str = "geeks"; str.toUpperCase(); str += "forgeeks"; String… Read More
Predict the output of the following program. class Test { String str = "a"; void A() { try { str +="b"; B(); } catch… Read More
Predict the output of the following program. class Test { public static void main(String[] args) { Double object = new Double("2.4"); int a = object.intValue();… Read More
Predict the output of the following program. class Test implements Cloneable { int a; Test cloning() { try { return (Test) super.clone(); } catch(CloneNotSupportedException… Read More
Predict the output of the following program. class Test { public static void main(String[] args) { String obj1 = new String("geeks"); String obj2 =… Read More
Predict the output of the following program. class Test { int a = 1; int b = 2; Test func(Test obj) { Test obj3… Read More
Predict the output of the following program. class Test { int a = 1; int b = 2; Test func(Test obj) { Test obj3… Read More
Predict the output of the following program. Java class Test { boolean[] array = new boolean[3]; int count = 0; void set(boolean[] arr, int… Read More
Predict the output of the following program. class First { void display() { System.out.println("Inside First"); } } class Second extends First {… Read More
Predict the output of the following program. abstract class demo { public int a; demo() { a = 10; } abstract public void set();… Read More
Predict the output of the following program. class Test { public static void main(String[] args) { StringBuffer a = new StringBuffer("geeks"); StringBuffer b = new… Read More
Predict the output of the following program. class Test { public void demo(String str) { String[] arr = str.split(";"); for (String s : arr) {… Read More
Predict the output of following Java program. class demoClass { int a = 1; void func() { demo obj = new demo(); obj.display(); }… Read More