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
mutable and immutable
:
Content language: English
Русский
What is the result of the following program execution? class MyLink { public MyLink() { str = "New"; } public String str; } public class Test { public static void main(String[] args) { MyLink b1 = new MyLink(); MyLink b2 = b1; b2.str = "My String"; System.out.println(b1.str); String a1 = "Test"; String a2 = a1; System.out.println(a2); a1 = "Not a Test"; System.out.println(a2); } }
mutable and immutable
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; } }
mutable and immutable
What will be displayed to console after the following code is executed? public class Test { public static void main(String[] args) { String s = new String("ssssss"); StringBuffer sb = new StringBuffer("bbbbbb"); s.concat("-aaa"); sb.append("-aaa"); System.out.println(s); System.out.println(sb); } }
mutable and immutable
What will be printed out after the following code is compiled and executed? String d = "beekeeper"; d.substring(1,7); d = "w" + d; d.insert(3, "bee"); System.out.println(d);
mutable and immutable
What will be indicated in the console? public class D { public static void main(String[] args) { E e = new E(); e.someVariable = 100; e.doIt(e); System.out.println(e.someVariable); } } class E { public int someVariable = 10; public void doIt(E aE) { aE.someVariable++; } E() { } }
mutable and immutable
What will be displayed as a result of the following code compilation and execution? String x = "Java"; x.concat(" Rules!"); System.out.println("x = " + x); x.toUpperCase(); System.out.println("x = " + x); x.replace('a', 'X'); System.out.println("x = " + x);
mutable and immutable
← Prev
1
Next →
Sign Up Now
or
Subscribe for future quizzes