Parameterized Method using Java
Write a program in Java using Parameterized Method
Program:
class
Rectangle
{
float area(float l,float b)
{
return (l*b);
}
}
class Sk07
{
public static void main(String args[])
{
Rectangle ob1=new Rectangle();
float ar1=ob1.area(5.5f,6.5f);
System.out.println("Area =
"+ar1);
}
}
Compile:
D:\>javac
Sk07.java
Run:
D:\>java
Sk07
Output:
Area =
35.75
Comments
Post a Comment