Monday, 28 November 2016

Program to create a class 'PackageUse' to import the above package 'useFul' and use the method area( )

In previous program, we have crated a package named useFul and added class UseMe in that package. Now in this program we use that package to import the class "UseMe" in class "PackageUse". Here we have used the area( ) method of UseMe class.


PROGRAM
import useFul.UseMe;

class PackageUse
{
 public static void main(String b[])
 {
  UseMe um = new UseMe();
  um.area(12,7);
 }
}
OUTPUT
C:\>javac PackageUse.java
C:\>java PackageUse
Length of Rectangle = 12.0
Breadth of Rectangle = 7.0
Area of Rectangle = 84.0

No comments:

Post a Comment