About 3,620,000 results
Open links in new tab
  1. Java Program To Calculate Area Of Circle | 5 Ways - Java Tutoring

    Apr 16, 2025 · The following Java program to print the area of a circle has been written in five simple different ways, static method, using constructor, Interface, inheritance with sample outputs for each program. Table of contents: 5 Simple ways to print AOC. Using Static Method; Using Interface; Inheritance; Using Constructor; Using Method

  2. Java - Calculate Area Of Rectangle And Area Of Circle Using Interface

    Aug 21, 2016 · interface area { double pi = 3.14; double calc(double x, double y); } class rect implements area { public double calc(double x, double y) { return (x*y); } } class cir implements …

  3. Java Program to Implement Shape Interface using Circle and …

    This is a Java Program to Make Shape as an Interface and Implement it using Circle and Rectangle Class. Interfaces are syntactically similar to classes, but they lack instance variables, and their methods are declared without any body.

  4. Java Program to Calculate and Display Area of a Circle

    Jul 28, 2022 · Given a radius of the circle, write a java program to calculate and display the area of the circle. (Take ∏=3.142) Example. Output: Area of circle is : 78.55. Input : radius= 8. Output: Area of circle is : 201.08.

  5. Java - Shape with the getArea() method - w3resource

    Mar 13, 2025 · Write a Java program to create an interface Shape with the getArea () method. Create three classes Rectangle, Circle, and Triangle that implement the Shape interface. Implement the getArea () method for each of the three classes. Sample Solution: Java Code:

  6. PROGRAM FOR CALCULATING AREA OF A RECTANGLE AND CIRCLE USING INTERFACES

    program for calculating area of a rectangle and circle using interfaces import java.lang.*; interface Area { final static float pi=3.14F; float compute (float x,float y); }...

  7. Write a Java program for calculating the area of shapes (circle

    Feb 4, 2025 · System.out.println("Circle Area: " + circle.area()); System.out.println("Rectangle Area: " + rectangle.area()); }} // Using Setter Methods. import java.io.*; interface Shape1 { double area(); } // Circle class implementing Shape1 interface. class Circle implements Shape1 { double radius; // Method to set the radius public void setRadius(double r)

  8. Shape Interface Implementation: Java Exercise - Interview Sansar

    Aug 18, 2024 · EXERCISE: Create a Shape interface having methods area () and perimeter (). Create 2 subclasses, Circle and Rectangle that implement the Shape interface. Create a class Sample with main method and demonstrate the area and perimeters of both the shape classes.

  9. Java - Abstract Shape Class with Circle and Triangle Subclasses

    4 days ago · Write a Java program to create an abstract class Shape with abstract methods calculateArea () and calculatePerimeter (). Create subclasses Circle and Triangle that extend the Shape class and implement the respective methods …

  10. Java Program to Calculate Area of a Circle – TecAdmin

    6 days ago · In this article, we’ll discuss how to calculate the area of a circle using Java and will provide a simple program as an example. The formula to calculate the area of a circle is: Where: π (Pi) is a constant approximately equal to 3.14159. r is the radius of the circle. Lets check with an example of Java program that calculate area of a circle:

  11. Some results have been removed
Refresh