In pascal when I want to declared type like enumerated type for eg date : 1 .. 31 How do I do that in Java ? I know in JDK 1.5 there enum class so I declare wz it public enum weekdays ( monday, tues, etc) But how about if I want to declare date that are from 1 to 31, need I mentioned all the 31 numbers or there's another way to do it.
Here's a Sun article about enums. I have to admin I haven't used them ... the first time I tried my version of Eclipse didn't like them and I keep forgetting to try again. Let us know how they work for you.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
We're pleased to have you here with us, but there are a few rules that need to be followed, and one is that proper names are required. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.
In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.
Thanks Stan & Jeff for the link, it’s really helpful. It just don’t work wz the J2SE 1.4, will need the 5.0 for it to work. For enumerating the days of the month, it’s my homework to convert the date : 1 .. 31 in pascal to java, guess will have to declare it as int and then use an if statement to print an error message if somebody enter a number outside of that range. Else can I use the “throw exception”, but don’t really know much about this rules can somebody help me out or provide me with some good links.