Enums injava
Java
public class EnumTest {
Day day;
public EnumTest(Day day) {
this.day = day;
}
public void tellItLikeItIs() {
switch (day) {
case MONDAY:
System.out.println("Mondays are bad.");
break;
case FRIDAY:
System.out.println("Fridays are better.");
break;
case SATURDAY: case SUNDAY:
System.out.println("Weekends are best.");
break;
default:
System.out.println("Midweek days are so-so.");
break;
}
}
public static void main(String[] args) {
EnumTest firstDay = new EnumTest(Day.MONDAY);
firstDay.tellItLikeItIs();
EnumTest thirdDay = new EnumTest(Day.WEDNESDAY);
thirdDay.tellItLikeItIs();
EnumTest fifthDay = new EnumTest(Day.FRIDAY);
fifthDay.tellItLikeItIs();
EnumTest sixthDay = new EnumTest(Day.SATURDAY);
sixthDay.tellItLikeItIs();
EnumTest seventhDay = new EnumTest(Day.SUNDAY);
seventhDay.tellItLikeItIs();
}
}
public enum Day {
SUNDAY, MONDAY, TUESDAY, WEDNESDAY,
THURSDAY, FRIDAY, SATURDAY
}
Also in Java:
- Title
- java try catch
- Category
- Java
- Title
- java list to array
- Category
- Java
- Title
- lopp array java
- Category
- Java
- Title
- Linked List implementation
- Category
- Java
- Title
- java shortest if else statement
- Category
- Java
- Title
- java scanner next()
- Category
- Java
- Title
- java valeur absolue
- Category
- Java
- Title
- array in java
- Category
- Java
- Title
- prendere valore da tastiera java
- Category
- Java
- Title
- parseints(str) java
- Category
- Java
- Title
- android dismiss keyboard
- Category
- Java
- Title
- entre clavier java
- Category
- Java
- Title
- read a file in java and store as integer array using buffered reader
- Category
- Java
- Title
- java - get open ports
- Category
- Java
- Title
- java while
- Category
- Java
- Title
- how to open a folder in java swing project
- Category
- Java
- Title
- pascal's triangle java 2d array
- Category
- Java
- Title
- height constraint layout guideline
- Category
- Java
- Title
- connecting to h2 database from java
- Category
- Java
- Title
- print values of bst java
- Category
- Java
- Title
- ecommerce app github android
- Category
- Java
- Title
- Java array multidimensional hashcode
- Category
- Java
- Title
- set preference value android
- Category
- Java
- Title
- how to compare two maps in java
- Category
- Java
- Title
- java php object
- Category
- Java
- Title
- java for each
- Category
- Java
- Title
- init admob
- Category
- Java
- Title
- how to calculate exponential in java
- Category
- Java
- Title
- java check if string is number
- Category
- Java
- Title
- capacitor-android. Unfortunately you can't have non-Gradle Java modules and Android-Gradle modules in one project
- Category
- Java
- Title
- java set to list
- Category
- Java
- Title
- j
- Category
- Java
- Title
- print map java
- Category
- Java
- Title
- java arraylist
- Category
- Java
- Title
- for loop in java stack overflow
- Category
- Java
- Title
- spigot run task later
- Category
- Java
- Title
- multiplication program java
- Category
- Java
- Title
- sort a map based on keys and values using java 8
- Category
- Java
- Title
- how lock horizontal orientation android
- Category
- Java
- Title
- how to find length of array in java
- Category
- Java
- Title
- recursion in java
- Category
- Java
- Title
- has been compiled by a more recent version of the Java Runtime (class file version 56.0), this version of the Java Runtime only recognizes class file versions up to 55.0
- Category
- Java
- Title
- how to make a loop in java
- Category
- Java
- Title
- java min function
- Category
- Java
- Title
- how to iterate list in java selenium
- Category
- Java
- Title
- java enum
- Category
- Java
- Title
- read csv in java in spring
- Category
- Java
- Title
- read integer input java
- Category
- Java
- Title
- java "->"
- Category
- Java
- Title
- parallel sorting in java 8
- Category
- Java
- Title
- java merge sort
- Category
- Java
- Title
- e
- Category
- Java
- Title
- setting up javafx in eclipse
- Category
- Java
- Title
- java mockito any string import
- Category
- Java
- Title
- how to loop through an array
- Category
- Java
- Title
- big integer java
- Category
- Java
- Title
- java get environment variables
- Category
- Java
- Title
- how to exit a for loop in java
- Category
- Java
- Title
- convert int array to integer list java
- Category
- Java
- Title
- generic method lambda java
- Category
- Java
- Title
- how to check type of primitive value in java
- Category
- Java
- Title
- java hashtable
- Category
- Java
- Title
- arraylist java methds
- Category
- Java
- Title
- java cast duration to long
- Category
- Java
- Title
- java newinstance alternative
- Category
- Java
- Title
- vector length java
- Category
- Java
- Title
- how to remove a certain string in a arraylist java
- Category
- Java
- Title
- java convert a string to char[]
- Category
- Java
- Title
- java jaxb unmarshall xml to map
- Category
- Java
- Title
- java array check duplicates
- Category
- Java
- Title
- unity how to make a gameobject slowly look at a position
- Category
- Java
- Title
- switch en java
- Category
- Java
- Title
- how to initialize array in java
- Category
- Java
- Title
- how to check if a string contains only alphabets and space in java
- Category
- Java
- Title
- java connect mariadb
- Category
- Java
- Title
- java null pointer exception
- Category
- Java
- Title
- java create jframe
- Category
- Java
- Title
- iterate map in java
- Category
- Java
- Title
- java connect to mysql
- Category
- Java
- Title
- spigot actionbar
- Category
- Java
- Title
- how to add strings together
- Category
- Java
- Title
- java int to int array
- Category
- Java
- Title
- java int stream min
- Category
- Java
- Title
- remove item from arraylist in java
- Category
- Java
- Title
- android java convert double to 2 decimal places
- Category
- Java
- Title
- creating the functional interface in java
- Category
- Java
- Title
- how to create a circle in java
- Category
- Java
- Title
- delete object java
- Category
- Java
- Title
- spigot repeating task
- Category
- Java
- Title
- fusion vecteur ordonner java
- Category
- Java
- Title
- count occurrences of character in string java 8
- Category
- Java
- Title
- reverse string using recursion java with explanation
- Category
- Java
- Title
- java program to find prime number between 1 and 100
- Category
- Java
- Title
- java function that returns the index of the largest value in an array
- Category
- Java
- Title
- how to print ascii value in java
- Category
- Java
- Title
- jbutton set background transparent
- Category
- Java
- Title
- java remove duplicates
- Category
- Java
- Title
- bootstrap button bigger
- Category
- Java
- Title
- how to declare a linked list in java
- Category
- Java
- Title
- calculating the percentile in java
- Category
- Java