Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: Enumerated Types

  1. #1
    Junior Member
    Join Date
    Jan 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Enumerated Types

    I recently discovered that enum type is a special class, constructors can be formed, instance variables, and the enum data declaration can posses a primitive type.

    My question is, in the general sense:

    Code:
    private enum Foo {
    COMMA (","),
    SEMICOLON (";");
    private String poo 
    Foo (String poo) {
    this.poo = poo;
    private String poo {return poo};
    }
    I would like to better understand this. I know I can create a variable of Foo such as Foo morePoo and access the , and ; using the names but I just don't know how well. Strong application in parsing and compiler design.

    Thank you for the info
    Last edited by helloworld922; January 27th, 2011 at 08:51 PM.


  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,155
    My Mood
    Hungover
    Thanks
    141
    Thanked 595 Times in 510 Posts

    Default Re: Enumerated Types

    I don't really understand your question. What are you asking? You might consider providing an SSCCE (that's a link) that demonstrates what you're talking about.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,155
    My Mood
    Hungover
    Thanks
    141
    Thanked 595 Times in 510 Posts

    Default Re: Enumerated Types

    Crossposted twice:

    Enumerated Types - Java Forums
    OTN Discussion Forums : Enumerated types and recursive descent ...

    The fact that the OP has already received an answer in one of his other threads is a perfect example of why crossposting is frowned upon. I basically wasted my time reading this thread and posting my reply.
    Last edited by KevinWorkman; January 27th, 2011 at 07:38 AM.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  4. #4
    Super Moderator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,225
    Thanks
    176
    Thanked 817 Times in 760 Posts
    Blog Entries
    5

    Default Re: Enumerated Types

    Quote Originally Posted by KevinWorkman View Post
    I basically wasted my time reading this thread and posting my reply.
    Indeed. Thanks for posting the links. If for any reason the original poster comes back to read this...suggested reading: The problems with crossposting

Similar Threads

  1. incompatible types
    By frozen java in forum What's Wrong With My Code?
    Replies: 3
    Last Post: January 25th, 2011, 09:40 AM
  2. incompatible types Exception
    By world.java in forum What's Wrong With My Code?
    Replies: 2
    Last Post: November 17th, 2010, 12:33 PM
  3. Incompatible Types
    By Kimimaru in forum What's Wrong With My Code?
    Replies: 3
    Last Post: June 28th, 2010, 09:52 AM
  4. Storing in different types of variables
    By giorgos in forum Collections and Generics
    Replies: 0
    Last Post: November 22nd, 2009, 01:02 PM
  5. Java chatting program implementing socket logic
    By sivakrishna.g in forum Java Networking
    Replies: 2
    Last Post: October 20th, 2009, 12:47 AM