What will be displayed after the following code is compiled?

class Outer {
   int outer_x = 100;
   void test() {
       for(int i = 0; i < 5; i ++) {
           class Inner{
               void display() {
                   System.out.print("outer_x = " + outer_x + "; ");
               }
           }
           Inner inner = new Inner();
           inner.display();
       }
   }
}
public class InnerClassDemo {
     public static void main(String args[]) {
         Outer outer = new Outer();
         outer.test();
     }
}

Follow CodeGalaxy

Mobile Beta

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