Skip to content
Snippets Groups Projects
Commit c7d300d7 authored by lbr's avatar lbr
Browse files

Erster Test mit IntelliJ Git

parent 691d4fd9
No related branches found
No related tags found
No related merge requests found
No preview for this file type
public class Main { public class Main {
public static void main(String[] args) { public static void main(String[] args) {
int value = 4; /*int value = 4;
switch (value) { switch (value) {
case 1 -> System.out.println("Value was 1"); case 1 -> System.out.println("Value was 1");
case 2 -> System.out.println("Value was 2"); case 2 -> System.out.println("Value was 2");
...@@ -11,17 +11,16 @@ public class Main { ...@@ -11,17 +11,16 @@ public class Main {
default -> System.out.println("Value was not 1 or 2"); default -> System.out.println("Value was not 1 or 2");
} }
String month = "aprilr"; String month = "aprilr";
System.out.println(month + " is in the " + getQuarter(month) + " quarter"); System.out.println(month + " is in the " + getQuarter(month) + " quarter");*/
// System.out.println(getNATO('x'));
getDayOfTheWeek(3);
} }
/*#
Das ist ein neuer Kommentar.
*/
public static String getQuarter(String month) { public static String getQuarter(String month) {
return switch (month) { return switch (month) {
case "january", "february", "march" -> "1st"; case "january", "february", "march" -> "1st";
case "april", "may", "june" -> "2nd"; case "april", "may", "june" -> "2nd";
case "july", "august", "september" -> "3rd"; case "july", "august", "september" -> "3rd";
case "october", "november", "december" -> "4th"; case "october", "november", "december" -> "4th";
default -> { default -> {
String badResponse = month + " is bad "; String badResponse = month + " is bad ";
...@@ -31,4 +30,33 @@ public class Main { ...@@ -31,4 +30,33 @@ public class Main {
} }
}; };
} }
public static String getNATO(char letter) {
return switch (letter) {
case 'A' -> "Able";
case 'B' -> "Baker";
case 'C' -> "Charlie";
case 'D' -> "Dog";
case 'E' -> "Easy";
default -> {
yield "Character " + letter + " not found";
}
};
}
public static void getDayOfTheWeek(int day) {
String dayOfTheWeek = switch (day) {
case 0 -> "Sunday";
case 1 -> "Monday";
case 2 -> "Tuesday";
case 3 -> "Wednesday";
case 4 -> "Thursday";
case 5 -> "Friday";
case 6 -> "Saturday";
default -> {
yield "There is no day no. " + day + " in the week.";
}
};
System.out.println(dayOfTheWeek);
}
} }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment