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
methods
:
Content language: English
Русский
What will be printed out as a result of the following code execution / compilation? public class Test { private String name; Test(String name) { this.name = name; } public void test(final Test test) { test = new Test("three"); } public String toString() { return name; } public static void main(String[] args) { Test t1 = new Test("one"); Test t2 = new Test("two"); t1.test(t2); System.out.println(t2); } }
methods
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); } }
methods
Is it possible to refer to a private method of some class from another instance of the same class?
methods
Which of the following methods are declared correctly?
methods
What will be printed as a result of the following code execution? public class Test { public static void main(String[] args) { int i = 1; add(i++); System.out.println(i); } static void add(int i) { i += 2; } }
methods
What will be the result of the following code compilation and execution? public class Base { public Object print() { return "Object from base method"; } public static void main(String[] args) { Base test = new Child(); System.out.println(test.print()); } } class Child extends Base { public String print() { return "String from child method"; } }
methods
What will be printed out after the following code execution? public class Test { private String name; Test(String name) { this.name = name; } public void test(Test test) { test = new Test("three"); } public String toString() { return name; } public static void main(String[] args) { Test t1 = new Test("one"); Test t2 = new Test("two"); t1.test(t2); System.out.println(t2); } }
methods
Check all methods the Object class contains.
methods
What will be printed as the result of the following program execution? public class C { public static void main(String[] args) { try { foo(); System.out.print("A "); } catch (Exception e) { System.out.print("B "); } finally { System.out.print("C "); } } private static void foo() throws Exception { try { System.out.print("A1 "); throw new Exception(); } catch (Exception e) { System.out.print("B1 "); throw new Exception(); } finally { System.out.print("C1 "); } } }
methods
Select all pairs of methods that are incompatible with each other in the same class.
methods
← Prev
1
2
Next →
Sign Up Now
or
Subscribe for future quizzes