package Package1;
public class Student
{
                public void name()
                {
                                System.out.println("Vikrant Kumar");
                }
}

 

package Package2;
public class Students
{
                public void address()
                {
                                System.out.println("Bihar");
                }
}

 

import Package1.Student;
import Package2.Students;
class TestPackage
{
                public static void main(String args[])
                {
                                Student object=new Student();
                                Students objects=new Students();
                                object.name();
                                objects.address();
                }
}

JAVA 32.PNG

Advertisements