Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class RectangleRunner{
- public static void main(String[] args){
- Rectangle def = new Rectangle();
- System.out.println( "This is a default rectangle. I will call its toString by printing this object out" );
- System.out.println( def );
- System.out.println( "Now I will change the values of this default rectangle using mutators");
- def.setLength(3);
- def.setWidth(4);
- System.out.println( def );
- System.out.println("Here is the length alone using its accessor");
- System.out.println( def.getLength() );
- System.out.println("I could create another rectangle using just its specified constructor");
- Rectangle r = new Rectangle(5, 12);
- System.out.println( r );
- System.out.println("Here is this rectangle's diagonal " + r.diagonal() );
- }
- }
Add Comment
Please, Sign In to add comment