answersLogoWhite

0


Best Answer

public class CircleDiameter { publicCircleDiameter() { super(); } publicfloatgetDiameterFrmRadius(float radius){ return radius * 2; } /** * @param args */ public static void main(String[] args) { float radius = 5; CircleDiameter circle = newCircleDiameter(); float dia = circle.getDiameterFrmRadius(radius); System.out.println("Diameter of this circle is: " + dia); } }

User Avatar

Wiki User

15y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

11y ago

/* Program to find out area of circle. */

public class Circle{

public static void main(String args[]) {

int r=5; //radius of circle

// here value of radius initialized.We can take the value at run time.

final double pi=3.i4; // value of pi which is fixed

double area; //To store the area of circle in area variable

area=pi*r*r;

System.out.println("Area of circle = "+area);

} //end of main

} //end of class

This answer is:
User Avatar

User Avatar

Wiki User

14y ago

// Area of a circle = pi*r2

public static double getArea(double radius) {

return Math.PI * radius * radius;

}

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Find diameter of the circle in java program?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Write a java code to draw a circle inside in an ellipse?

write a program draw circle and ellipse by using oval methods in java


Can you get a Java program to find the cube of a number?

Yes


What do you mean by multithread program in java?

A Program in Java that spawns multiple threads is called a multithreaded program in Java.


How do you write a java program to find the ad joint of a matrix?

bgfygfrhjyuyhh


Write a menu driven program in java to find area of different shapes. 1. Circle 2. Triangle 3. Rectangle?

Remember that the area of a rectangle is width * height: static int getArea(Rectangle r) { return r.width * r.height; }


How do you write a java program for finding multiligual languages?

You can use Java's built-in functions to write a code that will find multilingual languages.


Where can someone find information on the Java language for no such method error be found?

"No such method" is an error message that may appear when attempting to create a program with Java. Users who understand the Java programming language can find an answer on websites such as Stack Overflow and Crafting Java.


What is java program on computers?

#!/usr/bin/perl print 'java program';


What is java virtucal mechine?

That refers to the program that runs the compiled Java program.


Jntu 2-2 oops through java answers?

write a java program to find factorial using recursive and non recursive


How do you write a java program to find the square root of a number?

You can use the Math.sqrt() method.


What powder game doesnt need java?

Any program written for the Java technology needs Java. Any program NOT written for Java DOESN'T need it.