mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-23 09:41:36 +00:00
[java/en] Enum Type
Outputs in line.
This commit is contained in:
parent
50a0bbf33f
commit
5a8a68988b
@ -719,16 +719,12 @@ public class EnumTest {
|
||||
|
||||
public static void main(String[] args) {
|
||||
EnumTest firstDay = new EnumTest(Day.MONDAY);
|
||||
firstDay.tellItLikeItIs();
|
||||
firstDay.tellItLikeItIs(); // => Mondays are bad.
|
||||
EnumTest thirdDay = new EnumTest(Day.WEDNESDAY);
|
||||
thirdDay.tellItLikeItIs();
|
||||
thirdDay.tellItLikeItIs(); // => Midweek days are so-so.
|
||||
}
|
||||
}
|
||||
|
||||
// The output is:
|
||||
// Mondays are bad.
|
||||
// Midweek days are so-so.
|
||||
|
||||
// Enum types are much more powerful than we show above.
|
||||
// The enum body can include methods and other fields.
|
||||
// You can se more at https://docs.oracle.com/javase/tutorial/java/javaOO/enum.html
|
||||
|
Loading…
Reference in New Issue
Block a user