Thursday, 8 August 2019

Calling from Packages in Java

// Program
package mypackage;
public class pkg1
{
    public pkg1()
    {
        System.out.println("Constructor of Package 1");
    }
}
package mypackage;
public class pkg2
{
    public pkg2()
    {
        System.out.println("Constructor of Package 2");
    }
}
import mypackage.*;
public class pkgdemo
{
    public static void main(String args[])
    {
        pkg1 obj=new pkg1();
        pkg2 obj1=new pkg2();
    }
}

1 comment:


  1. Interesting article! Thank you for sharing them! I hope you will continue to have similar posts to share with everyone.

    Radhanagar Beach Andaman

    ReplyDelete

Note: only a member of this blog may post a comment.