Java static field Question 3

Question

We would like to

What is the output of the following code?

public class Main {

  static String name = "Java";

  public static void main(String[] args) {

    String name = "Javascript";

    new OtherClass();

  }//from w  w  w  . j a va2s  .c  o m

}

class OtherClass {

  OtherClass() {

    String name = "Java 13";

    System.out.println(name);

    System.out.println(Main.name);

  }

}


Java 13
Java



PreviousNext

Related