Java static field Question 2

Question

What is the output of the following code?

public class Main {

  String name = "Java";

  public static void main(String[] args) {

    new Main();//from w  w  w.j a  v  a 2s . c  o m

  }

  Main() {

    System.out.println(name);

    String name = "Javascript";

    System.out.println(name);

    System.out.println(this.name);

  }

}


Java
Javascript
Java



PreviousNext

Related