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

Comments

Popular posts from this blog

Develop an Android application to display “Hello World!” on screen

Program to design an applet which draws a circle (having color BLUE) inside a triangle (having color YELLOW)

Build a Simple Android App to Display Student Details