• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

Question about redefining Enum

 
Ranch Hand
Posts: 694
Mac OS X Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
He was expelled for perverse baking experiments. This tiny ad is a model student:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic