What will happen when the following code is compiled and run?

1:  public class Clazz {
2:      public boolean flags[] = new boolean[2];
3:      public static void main(String[] args){
4:          Clazz clazz = new Clazz();
5:          System.out.println("flags[1] = " + clazz.flags[1]);
6:      }
7:  } 

Follow CodeGalaxy

Mobile Beta

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