Quizzes
Site Language: English
Українська
English
Русский
Programming Tests
Login
Sign Up
Programming Tests
Theory
Snippets
Papers
Landing
Android
Prices
FAQ
Cosmo Story
Terms and Conditions
Privacy Policy
Cookies Policy
Send Feedback
overload
:
Content language: English
Русский
What will be printed out as a result of the following code execution / compilation? public class Test { static void m(int ... a) { System.out.println("1"); } static void m(Integer ... a) { System.out.println("2"); } public static void main(String[] args) { m(1, 2); } }
overload
What will be printed out as a result of the following code compilation and execution? public class Quest { public static void main() { System.out.print("A"); } public static void main(String args) { System.out.print("B"); } public static void main(String[] args) { System.out.print("C"); } }
overload
What will be printed out to console? public class Z { public void print( Object o ) { System.out.println( "Object" ); } public void print( String str ) { System.out.println( "String" ); } public void print( Integer i ) { System.out.println( "Integer" ); } public static void main(String[] args) { Z z = new Z(); z.print( null ); } }
overload
What is the result of the following code compilation and execution? public class MainClass { public static void test(int ...a) { System.out.println("int..."); } public static void test(Integer ...a) { System.out.println("Integer..."); } public static void test(Number ...a) { System.out.println("Number..."); } public static void main(String args[]){ Number n = new Integer(1); test(n.intValue()); } }
overload
What is the result of the following code compilation and execution? public class Clazz { private void process(String... s) { System.out.print("*"); } private void process(String s) { System.out.print("1"); } private void process(String s, String a) { System.out.print("2"); } public static void main(String[] args) { Clazz c = new Clazz(); c.process("asd"); c.process("asd","asd"); c.process("asd","asd","asd"); } }
overload
What will be the result of compiling and running this code? class A {} interface I {} class B extends A implements I {} public class OverloadTest { static public void foo(A a) { System.out.print("A"); } static private void foo(B b) { System.out.print("B"); } static private void foo(I i) { System.out.print("I"); } public static void main(String[] args) { A a = new B(); OverloadTest.foo(a); OverloadTest.foo((I) a); } }
overload
What is the result of the following code fulfillment: class A { public void m(int k) { System.out.println("class A, method m : " + ++k); } } class B extends A { public int m(int k) { System.out.println("class B, method m : " + k++); return k; } } public class MainClass { public static void main(String args[]) { A a = new B(); a.m(34); } }
overload
What will be the result of a: class Clidders { public final void flipper() { System.out.println("Flip a Clidder"); } } public class Clidlets extends Clidders { public void flipper() { System.out.println("Flip a Clidlet"); super.flipper(); } public static void main(String [] args) { new Clidlets().flipper(); } }
overload
What will be the result of the launch of this code? package tutorial.base; public class TypesTutorial { public static void main(String... args) { A alpha = new B(0); } } class A { A(int x){ // - 1 - a(x); // - 2 - } void a(int x) { System.out.println("A-a: " + x); } } class B extends A { B(int x) { // - 3 - a(x); // - 4 - } void a(int x) { System.out.println("B-a: " + x); } }
overload
What will be displayed? class A { int x = 1; public void printX() { System.out.println(getX()); } public int getX() { return x; } } class B extends A { int x = 2; public int getX() { return x + 1; } } public class Test { public static void main(String[] args) { A classA = new B(); classA.printX(); } }
overload
← Prev
1
2
Next →
Sign Up Now
or
Subscribe for future quizzes