Program to import package 'myPackage' and use the 'DisplayMsg' class in package

In previous program, we have crated a package named "myPackage" and added class "DisplayMsg" in that package. Now in this program we use that package to import the class "DisplayMsg" in class "PackageDemo".

import myPackage.DisplayMsg;

class PackageDemo
 public static void main(String[] args)
  DisplayMsg dm = new DisplayMsg();;
C:\>java PackageDemo
This is from package.

No comments:

Post a comment