This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Question about redefining Enum Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Question about redefining Enum" Watch "Question about redefining Enum" New topic
Author

Question about redefining Enum

Kaydell Leavitt
Ranch Hand

Joined: Nov 18, 2006
Posts: 688

I have a question about one of the question on Marcus Green's eXamulator 5.0. Enum is defined in the package java.lang, java.lang is automatically imported and you can't redefine a class at the same level right?

I don't understand how the following code works:

I also don't understand why the checkbox is declared as an int when we're working with enums.

shakunthala Divakar
Greenhorn

Joined: Aug 01, 2007
Posts: 13
Hi

If you add java.lang.Enum then the given code doesn't compile.
and If you add [code] java.lang.* and also which is by default added, then it compiles fine.

so i belive that , the class Enum is not imported until you use that in your code without defining it.
In the given code.If you use Enum next then,that will not be from java.lang instead that will be the one you defined.
I think Enum is not redefined,as it is not imported yet
Manfred Klug
Ranch Hand

Joined: Jun 04, 2007
Posts: 377
Originally posted by Kaydell Leavitt:
I also don't understand why the checkbox is declared as an int when we're working with enums.[/CODE]
Since they are two different things which only share the name.
 
 
subject: Question about redefining Enum
 
Similar Threads
Question 95 Rules Roundup
Optional semicolon in enumerated type declaration "when no other declarations for thi
enum values() method; enum's revisited
K & B, Chapter 3, Quiz Question 7
Enum valueOf method