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
Русский
Select all pairs of methods that are incompatible with each other in the same class.
overload
What will be the result of compiling and running the following code? public class Main { public static void var(int... x) //1 { System.out.println("int... x"); } public static void var(Object... x) //2 { System.out.println("Object... x"); } public static void var(Integer... x) //3 { System.out.println("Integer..."); } public static void main(String... args) { int i = 0; Integer i2 = 127; var(i, i2); } }
overload
What will be the result of compilation and execution of the following code? import java.util.*; public class Test { void a1(Object... i){ System.out.println("[Object... i]"); } void a1(Integer... i){ System.out.println("[Integer... i]");; } public static void main(String... args){ a1(new Integer[19]); } }
overload
What is the result of compiling and running the following code: public class Main { public static void main(String[] args) { Parent p = new Parent(); Child c = new Child(); Parent p2 = new Child(); useIt(p); useIt(c); useIt(p2); } final static void useIt (Parent p){ System.out.println("Parent"); } final static void useIt (Child c){ System.out.println("Child"); } } class Parent { } class Child extends Parent { }
overload
What will be the output of the following program: public class VarTest { public static void main(String[] X) { Integer x = 1; Integer y = 2; print(1); print(1,2); print(x); print(x,y); } static void print(int i) { System.out.print(1); } static void print(Integer... i) { System.out.print(2); } static void print(Integer i) { System.out.print(3); } static void print(int... i) { System.out.print(4); } }
overload
← Prev
1
2
Next →
Sign Up Now
or
Subscribe for future quizzes