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
object memory allocation
:
Content language: English
Русский
What will happen as a result of the following code? class A {} class B extends A {} public class Test { static public void main(String args[]) { B b = new B(); A a = b; if (a.hashCode() == b.hashCode()) System.out.print("Passed"); } }
object memory allocation
What happens when you try to compile and run this code: 00: public class Test { 01: public static void main(String[] args) { 02: Object obj = new String("String object"); 03: String str = (String) new Object(); 04: System.out.println(obj); 05: System.out.println(str); 06: } 07: }
object memory allocation
What will be printed by the following code? public class Test { static Boolean bo1 = new Boolean("true"); static Boolean bo2 = new Boolean(false); public static void main(String[] args) { Boolean bo3 = new Boolean(bo1); Boolean bo4 = new Boolean("bo2"); System.out.println(bo1.equals(bo3)); System.out.println(bo2.equals(bo4)); } }
object memory allocation
What will be the result of the following code: import java.util.*; public class Test { public static void main(String[] args) { Class c1 = new ArrayList<String>().getClass(); Class c2 = new ArrayList<Integer>().getClass(); System.out.println(c1 == c2); } }
object memory allocation
← Prev
1
Next →
Sign Up Now
or
Subscribe for future quizzes