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
anonymous classes
:
Content language: English
Русский
What will be the output of the program? public class Test { public static void main(String[] args) { for (int i = 0; i < 3; i++) { i = doIt(i); } } static int doIt(int i) { new Test() { { System.out.print((i + 0.99) + ", "); } }; return i; } }
anonymous classes
What will be the result of compiling and running the following code: public final class QTest { public static void main(String[] args) { new QTest() { public void show() { System.out.print("2"); } }.show(); } public void show() { System.out.print("1"); } }
anonymous classes
What class files will be created during the compilation of the following code? public class Count { class A { } public static void main(String[] args) { Object obj = new Object() { { System.out.println(this); } }; } } class Count$1 { }
anonymous classes
What will be the result of compilation and execution of the following code? public class TestClass { public static void main(String[] args) { String s = new String(){ public String toString(){ return "new method"; } } System.out.println(s); } }
anonymous classes
← Prev
1
Next →
Sign Up Now
or
Subscribe for future quizzes