Create the referance of the Operation class in Circle - LearnHowToCode SarkariResult.com Interview Questions and Answers LearnHowToCodeOnline
Create the referance of the Operation class in Circle

Create the referance of the Operation class in Circle


//Create the referance of the Operation class in Circle
class Operation
{
  int square(int n)
  { 
     return n*n;
   }
}




class Circle{
  Operation op;
double pi=3.14;

  double area(int radius)
{
  op=new Operation();
int rsquare=op.square(radius);
return pi*rsquare;
}
 public static void main(String[]args)
{
 Circle c=new Circle();
  double result=c.area(5);
System.out.println(result);
}
}        That is Output


  • c:/shashi/javac Operation.java
  • c:/shashi/java Circle 
  • 78.


About EasyToCode

I'm Ethan Mariano a software engineer by profession and reader/writter by passion.I have good understanding and knowledge of AngularJS, Database, javascript, web development, digital marketing and exploring other technologies related to Software development.

0 comments:

Featured post

Political Full Forms List

Acronym Full Form MLA Member of Legislative Assembly RSS Really Simple Syndication, Rashtriya Swayamsevak Sangh UNESCO United Nations E...

Powered by Blogger.