Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Java Advocacy > referencing Jav...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 3 Topic 2362 of 2410
Post > Topic >>

referencing Java enums in other classes???

by KKriwet@[EMAIL PROTECTED] Mar 14, 2008 at 05:46 AM

Hello,
since I am pretty new to Java, I apollogize for this stuipd question,
but I am really lost at the moment.
Here is a somehow modified example of what I want to do:

public enum TrafficLight {
         Green(0); Yellow (1); Red (2)
}


public enum TrafficSigns {
     Stop (0);

    :
}

// class to configure the settings of the current road ending in a
crossing
// assuming that there is only one traffic light controlling the go /
nogo status of this road;
public class RoadInCrossing {
    public int                  noLanes;
    public TrafficLights    thisTrafficLight;
    public TrafficSigns     thisTrafficSign;
    public Boolean          thisTrafficLightStatus;

    public configureRoadInCrossing (int noLanes, TrafficLight color,
TrafficSigns sign) {
                this.noLanes         =   noLanes;
                this.thisTrafficLight =  color;
                this.thisTrafficSign  =  sign;
                this.thisTrafficLightStatus = FALSE; //indicating that
trafficlight is off
    }
}

// now the environment complains (therortically correctly) that
TrafficLights and TrafficSigns      cannot be resolved - but how do I
get the system to get their meaning.
Well theoretically I might just put these values in the class and
hopefully solve the proble,m .. however as far as I can see at the
moment thes enumerations are basic enumerations that are going to be
used within the complete project, therefore I would like them to be
public....

Has anyone any idea on how I might get them known???

Ta
 




 3 Posts in Topic:
referencing Java enums in other classes???
KKriwet@[EMAIL PROTECTED]  2008-03-14 05:46:10 
Re: referencing Java enums in other classes???
Roedy Green <see_websi  2008-03-15 03:49:49 
Re: referencing Java enums in other classes???
Roedy Green <see_websi  2008-03-15 03:51:14 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed Jul 9 6:18:09 CDT 2008.