Tag Archives: 1z1808

Given: class Overloading { int x(double d) { System.out.println("one"); return 0; } String x(double d)

Given:class Overloading {int x(double d) {System.out.println(“one”);return 0;}String x(double d) {System.out.println(“two”);return null;}double x(double d) {System.out.println(“three”);return 0.0;}public static void main(String[] args) {new Overloading().x(4.0);}}What is the result? A. Three B. One C. Two D. Compilation fails. Correct Answer: D

Given: class Base { public static void main(String[] args) { System.out.println("Base " + args[2]); }

Given: class Base {public static void main(String[] args) {System.out.println(“Base ” + args[2]);}}public class Sub extends Base{public static void main(String[] args) {System.out.println(“Overriden ” + args[1]);}}And the commands:javac Sub.javajava Sub 10 20 30What is the result? A. Overridden 20 B. Base 30 Overridden 20 C. Base 30 D. Overridden 20 Base 30 Correct Answer: A

The protected modifier on a Field declaration within a public class means that the field ______________.

The protected modifier on a Field declaration within a public class means that the field ______________. A. Can be read and written from this class and its subclasses defined in any package B. Can be read but not written from outside the class C. Can be read and written from this class and its subclasses only within the… Read More »