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:
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
Post a Comment
If you have any query, please let us know