You are here: Home / Topics / Creating package example in Java

Creating package example in Java

Filed under: Java on 2023-09-17 13:20:18

// Program to explain Creating Package.

package  Pack1;

class First
{
public void view( )
{
 System.out.println( "This is First Class." );
}
}

public class  ImportPack2
{
public static void main( String args[ ] )
{
 First f = new First();
 f.view();
}
}

 

Output:

This is First Class.

About Author:
M
Mr. Dubey     View Profile
Founder and CEO of MCQ Buddy. I just like to help others. This portal helps students in getting study material free.