Create User define package and access them in Java

Create first class to include in package:
Idk.java

package mypack;
public class Idk
{
public void Hi()
{
System.out.println("Hello JAVA");
}
}

Save as in mypack folder


Write a program to import package 
import mypack.Idk;
class New
{
public static void main(String ar[])
 {
  Idk i=new Idk();
  i.Hi();
 }



Compile And Run the Program:


Video :

Output:



Comments