Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
J
javaTutorial
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
lbr
javaTutorial
Commits
c7d300d7
Commit
c7d300d7
authored
2 years ago
by
lbr
Browse files
Options
Downloads
Patches
Plain Diff
Erster Test mit IntelliJ Git
parent
691d4fd9
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
out/production/IntelliJGit/Main.class
+0
-0
0 additions, 0 deletions
out/production/IntelliJGit/Main.class
switch/switch/src/Main.java
+35
-7
35 additions, 7 deletions
switch/switch/src/Main.java
with
35 additions
and
7 deletions
out/production/IntelliJGit/Main.class
+
0
−
0
View file @
c7d300d7
No preview for this file type
This diff is collapsed.
Click to expand it.
switch/switch/src/Main.java
+
35
−
7
View file @
c7d300d7
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
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment