Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!nx02.iad01.newshosting.com!newshosting.com!news-out.readnews.com!transit3.readnews.com!postnews.google.com!y19g2000pre.googlegroups.com!not-for-mail From: Chad Newsgroups: comp.lang.java.programmer Subject: Re: A question about a few variables in a class Date: Sun, 14 Aug 2011 13:23:39 -0700 (PDT) Organization: http://groups.google.com Lines: 102 Message-ID: <9b372a01-59c9-462a-a5ca-463f3ededb9d@y19g2000pre.googlegroups.com> References: <8ff5e4fa-84c5-4d4a-97e8-0b2f3f5b0dc4@m5g2000prh.googlegroups.com> NNTP-Posting-Host: 66.81.213.89 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1313353419 26888 127.0.0.1 (14 Aug 2011 20:23:39 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sun, 14 Aug 2011 20:23:39 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: y19g2000pre.googlegroups.com; posting-host=66.81.213.89; posting-account=kTs1ygoAAACgG1TSoyECpovEyy-V6_8b User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-Header-Order: ARLUEHNKC X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; InfoPath.2),gzip(gfe) Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:7113 On Aug 13, 5:49=A0pm, Eric Sosman wrote: > On 8/13/2011 1:30 PM, Chad wrote: > > > On Aug 6, 4:56 am, Eric Sosman =A0wrote: > >>[...] > >> =A0 =A0 =A0 We don't actually know what Rectangle is because there are= no > >> import statements to tell us what package it's in. =A0It clearly > >> cannot be java.awt.Rectangle, which has public width and height > >> members but which has no getArea() and no suitable constructor. > > > Aye. I broke away from my own personal rule of posting code snippets. > > I should know better since it really annoys me when people post code > > snippets on comp.lang.c, and then, like magic, expect the group to be > > able to magically interpet their line of thought. > > =A0 =A0 =A0Just out of curiosity, what *is* the `Rectangle' you used? > Below is all 5 million lines of code from the book.... public class GeometricObject1 { private String color =3D "white"; private boolean filled; private java.util.Date dateCreated; public GeometricObject1() { dateCreated =3D new java.util.Date(); } public GeometricObject1(String Color, boolean filled) { dateCreated =3D new.java.util.Date(); this.color =3D color; this.filled =3D filled; } public String getColor() { return color; } public void setColor(String color) { this.color =3D color; } public boolean isFilled() { return filled; } public void setFilled(boolean filled) { this.filled =3D filled; } public java.util.Date getDateCreated() { return dateCreated; } public String toString() { return "created on " + dateCreated + "\ncolor" + color + " and filled" + filled; } } //Rectangle1 isn't a typo public class Rectangle1 extends GeometricObject1 { private double width; private double height; public Rectangle1() { } public Rectangle1(double width, double height, String color, boolean filled) { this.width =3D width; this.height =3D height; setColor(oolor); setFilled(filled); } public double getWidth() { return width; } public void setWidth(double width) { this.width =3D width; } public double getHeight() { return height; } public double setHeight(double height) { this.height =3D height; } public double getArea() { return width * height; } public double getPerimeter() { return 2 * (width + height); } }