View Single Post
  #2 (permalink)  
Old 12-07-2007, 04:14 PM
ShoeNinja's Avatar
ShoeNinja ShoeNinja is offline
Senior Member
 
Join Date: Oct 2007
Posts: 112
ShoeNinja is on a distinguished road
Send a message via AIM to ShoeNinja
You are not creating a rectangle object. When you try to define width, there is no object there.

Code:
public class DrawRec { public static void main(String[] args) { Rectangle myRect = new Rectanle(); myRect.width = 40; myRect.height = 50; System.out.println("myRect's area is " + myRect.area()); } }
Reply With Quote