• Post Reply Bookmark Topic Watch Topic
  • New Topic

Cant tell whats my problem is, using two classes  RSS feed

 
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have two classes in two different files. Color.java and Light.java

the Color cclass:

and i have the Light class :
 
Saloon Keeper
Posts: 3331
46
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dan D'amico wrote:i have two classes in two different files. Color.java and Light.java

the Color cclass:

and i have the Light class :

color1 is only a reference to Color but so far color1 has not been set to an actual Color object instance.
You can put after your comment:

But this won't work until you add a Color constructor to your Color class that will take these arguments.
Also, I would suggest that you rename your Color class as that is a very commonly used class that already comes with Java. (Or maybe you should use the Java supplied Color class instead of inventing one of your own.)
 
Bartender
Posts: 5167
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dan D'amico, please BeForthrightWhenCrossPostingToOtherSites
http://www.java-forums.org/new-java/93455-having-problem-working-two-classes.html
 
Dan D'amico
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Darryl Burke wrote:Dan D'amico, please BeForthrightWhenCrossPostingToOtherSites
http://www.java-forums.org/new-java/93455-having-problem-working-two-classes.html


yes , sorry it was urgent .
 
Marshal
Posts: 56610
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is no such word as urgent on this website.

Except possibly on 1st April.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!