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 2 of 2

Thread: problem with enumeration

  1. #1
    Junior Member
    Join Date
    Aug 2012
    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default problem with enumeration

    So i dont know how to fix this... watching it now for 10-15 minutes and i got pissed of with such a simple program... The out come should be:

    Luka Low 2
    Jernej Vecji low 1
    Dejan Supak 0


    public enum notmain
    {
    	Luka("Low","2"),
    	Jernej("Vecji low", "1"),
    	Dejan("Supak", "0");
     
    	private final String Desc;
    	private final String Age;
     
    	notmain(String Description, String Year)
    	{
    		Desc = Description;
    		Age = Year;
    	}
    	public String getDesc()
    	{
    		return Desc;
    	}
    	public String getAge()
    	{
    		return Age;
    	}
    }


    and heres main where i get the error with people:

    public class main 
    {
    public class main 
    {
    	public static void main(String[] args)
    	{
    		for (notmain people: notmain.values());
    		{
    			System.out.printf("%s\t%s\t%s\n", people, people.getDesc(), people.getAge()); // heres the prob with people
    		}
    	}
    }


    most probly the solution takes less than a seccond and i will feel dumb when i'll see it...
    So what's wrong?

    *Edit geting the error with people in system out printf, not in enhanced for loop


  2. #2
    Junior Member
    Join Date
    Aug 2012
    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: problem with enumeration

    oh my gawd.............................................. ....... look in the main at for loop that ; .... i am sooooooooooooooo blind . Curse u ;!!

    Solved.....

Similar Threads

  1. Replies: 3
    Last Post: January 5th, 2012, 12:44 AM