What will the following lines print?
int[] array = {1,2}; 
System.out.println(Arrays.toString(array));
Explanation
Because array does not print its content by default, in Java there is a utility method Arrays.toString(array) that converts array to human readable string representation.

Follow CodeGalaxy

Mobile Beta

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