Tester Example

Description

Example code of java class tester
joannazhang13
Note by joannazhang13, updated more than 1 year ago
joannazhang13
Created by joannazhang13 over 9 years ago
12
0

Resource summary

Page 1

public class Tester{public static void main (String [] args){Shape circ= new Circle(10, "circle");Shape sq= new Square(9.4, "square");Square rectangle1= new Rectangle (10, 5, "rectangle);Rectangle rectangle2= new Rectangle(10, 5, "rectangle);System.out.println("The area of " +circ.getName()+ " is: " + circ.getArea());if (rectangle1.compareTo(rectangle2)==0){System.out.println("The two rectangles are the same size");}else{System.out.println("The two rectangles are not the same size");}System.out.println("The perimeter of" + sq.getName()+ " is: "+ sq.getArea());}}

Show full summary Hide full summary

Similar

Java Week 5 Object Oriented Programming
Troy Bowlin
What is an interface?
joannazhang13
Interface Example
joannazhang13
Java Practice 1
Ummm No
Java Practice 2
Ummm No
Servion - Java Questionnaire
rohit.benedict
Java Core. Basics
Gadget
Programming Review
Shannon Anderson-Rush
Useful String Methods
Shannon Anderson-Rush
Programming in Java
Faheem Ahmed
Object Oriented Programming Concepts
Cmagapu