// Abstraction class
// all object shasring with the same data method
class MyClass
{
void calculate(double x)
{
System.out.println("Square="+(x*x));
}
}
class Common
{
public static void main(String[]arr)
{
MyClass mc=new MyClass();
MyClass mc1=new MyClass();
MyClass mc2=new MyClass();
mc.calculate(3);
mc1.calculate(4);
mc2.calculate(5);
}
}
// all object shasring with the same data method
class MyClass
{
void calculate(double x)
{
System.out.println("Square="+(x*x));
}
}
class Common
{
public static void main(String[]arr)
{
MyClass mc=new MyClass();
MyClass mc1=new MyClass();
MyClass mc2=new MyClass();
mc.calculate(3);
mc1.calculate(4);
mc2.calculate(5);
}
}
0 comments:
Post a Comment