Main.java
Person.java
 

public class Main {
  public static void main(String[] args) {
    Person myObj = new Person();
    myObj.name = "John";
    System.out.println(myObj.name);
  }
}

Result:
Main.java:4: error: name has private access in Person
    myObj.name = "John";
         ^
Main.java:5: error: name has private access in Person
    System.out.println(myObj.name);
                  ^
2 errors