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: }

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Keep exploring
Java quizzes
Cosmo
Sign Up Now
or Subscribe for future quizzes