Skip to main content

Package problem

CODE

// file name: AccessPackage.java

import package_name.MyPackage;

public class AccessPackage {
public static void main(String[] args) {
MyPackage obj = new MyPackage();
obj.display();
}
}
// file name: my_package/MyPackage.java
package package_name;

public class MyPackage {
public void display() {
System.out.println("Hello World");
}
}