Originally posted by mert �zkaya:
1)What are the differences between classes and enum's ?
2)Does it have any function except creating output ?
And lastly, it is said that enum class types consist of objects but this objects represents the outputs. So how can be said that they are objects.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Originally posted by mert �zkaya:
2)Does it have any function except creating output ?
And lastly, it is said that enum class types consist of objects but this objects represents the outputs. So how can be said that they are objects.
Tony Morris
Java Q&A (FAQ, Trivia)
Originally posted by Layne Lund:
Enums can be used in switch statements. I think this is one of their most important functions.
Layne
Tony Morris
Java Q&A (FAQ, Trivia)
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them. - Laurence J. Peter
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them. - Laurence J. Peter
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them. - Laurence J. Peter
Originally posted by mert �zkaya:
We can only use these final variables as an output on the screen, is not it???
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Originally posted by mert �zkaya:
enum Size {narrow,baggy,wide,tight}; // instanstiating an object of enum class
Briefly my questions is that how can we say narrow,baggy,wide,tight are objects. I think they are all variables.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Originally posted by Tony Morris:
Speculation of course, but I just can't imagine that everybody at Sun is completely ignorant to what appears obvious - at least to me - avoid switch/case indiscriminately. On the flip side, I work for a large corporation on the J2SE spec. with a bunch of... er... "engineers" who wouldn't have half a clue about why switch/case is inherently flawed (total subscription to doctrine and not reasoning) - so it may just be a possibility within the Sun camp as well.
Originally posted by Layne Lund:
So is there some other reason that switch/case is "inherently flawed?"
Tony Morris
Java Q&A (FAQ, Trivia)
Originally posted by Layne Lund:
I prefer switch case when I have multiple options to choose from.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Abstraction is all very well, but at the end of the day you have to implement things. So would you like to have a go at implementing this advice for this switch/case block that I am guilty of writing?So far I have this:So now what? Do I write one class that implements that interface, or nine of them? And what goes in that class, or classes?Originally posted by Tony Morris:
Back to the switch/case, I propose that for every time you consider using one, write yourself an interface instead. The interface will contain one method, with one parameter that is of the same type as the type that you would have otherwise used in the switch expression. The method will also have a return type, but this cannot be talked about for the general case. Merely, that it should be an appropriate abstraction for "whatever it is that you were going to do in your case blocks".
Abstraction is all very well, but at the end of the day you have to implement things. So would you like to have a go at implementing this advice for this switch/case block that I am guilty of writing?
Tony Morris
Java Q&A (FAQ, Trivia)
Don't get me started about those stupid light bulbs. |