Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / June 2005

Tip: Looking for answers? Try searching our database.

enum within an enum

Thread view: 
- - 12 Jun 2005 09:40 GMT
public enum A {
    A1_ASC,
    A1_DSC,
    A2_ASC,
    A2_DSC;
}

If I access A1_ASC, I have to do A.A1_ASC.

Is it possible to have a so called enum within an enum so that i can do a:

A.ASC.A1
A.ASC.A1
A.DSC.A2
A.DSC.A2
Sympatico Member - 12 Jun 2005 09:58 GMT
http://www.brayneychyled.com/helpoutsometimes.htm
> public enum A {
>     A1_ASC,
[quoted text clipped - 11 lines]
> A.DSC.A2
> A.DSC.A2
- - 12 Jun 2005 11:18 GMT
> http://www.brayneychyled.com/helpoutsometimes.htm

Ctrl+K
Wibble - 12 Jun 2005 16:19 GMT
> public enum A {
>     A1_ASC,
[quoted text clipped - 11 lines]
> A.DSC.A2
> A.DSC.A2
how about
public class A {
  public static enum A1 {...}
  public static enum A2 {...}
}
Wibble - 12 Jun 2005 16:20 GMT
>> public enum A {
>>     A1_ASC,
[quoted text clipped - 18 lines]
>   public static enum A2 {...}
> }
Oops
public class A {
  static enum ASC ...
}
- - 13 Jun 2005 01:33 GMT
>> how about
>> public class A {
[quoted text clipped - 6 lines]
>   static enum ASC ...
> }

I tried that but instead of having the method accepting (A a) as the
parameter, I must change it to 'method(A.ASC a)' and add another method
'method(A.DSC a)' rather than having one method 'method(A a)'.
- - 13 Jun 2005 01:51 GMT
>>> how about
>>> public class A {
[quoted text clipped - 10 lines]
> parameter, I must change it to 'method(A.ASC a)' and add another method
> 'method(A.DSC a)' rather than having one method 'method(A a)'.

nvm.. i get what you mean.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.