Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
L
load-file-back
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
formation-dev-web
load-file-back
Commits
c18a54f0
Commit
c18a54f0
authored
1 year ago
by
Laurine
Browse files
Options
Downloads
Patches
Plain Diff
3-a CLI in the main
parent
31b55cba
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/com/example/livecodingjavaspring/App.java
+25
-0
25 additions, 0 deletions
src/main/java/com/example/livecodingjavaspring/App.java
with
25 additions
and
0 deletions
src/main/java/com/example/livecodingjavaspring/App.java
+
25
−
0
View file @
c18a54f0
...
@@ -19,5 +19,30 @@ public class App {
...
@@ -19,5 +19,30 @@ public class App {
users
.
add
(
new
User
(
"Jean"
,
"TENRIEN"
,
22
));
users
.
add
(
new
User
(
"Jean"
,
"TENRIEN"
,
22
));
users
.
add
(
new
User
(
"Lara"
,
"TATOUILLE"
,
24
));
users
.
add
(
new
User
(
"Lara"
,
"TATOUILLE"
,
24
));
users
.
forEach
(
System
.
out
::
println
);
users
.
forEach
(
System
.
out
::
println
);
int
choice
=
-
1
;
while
(
choice
!=
0
)
{
Scanner
scanner
=
new
Scanner
(
System
.
in
);
System
.
out
.
println
(
"Hello jeune Peufien ! dans ma super CLI"
);
System
.
out
.
println
(
"Que veux-tu faire ?"
);
System
.
out
.
println
(
"1- Lister les utilisateurs"
);
System
.
out
.
println
(
"2- Ajouter un utilisateur"
);
choice
=
parseInt
(
scanner
.
next
());
switch
(
choice
)
{
case
1
->
users
.
forEach
(
System
.
out
::
println
);
case
2
->
{
System
.
out
.
println
(
"Prénom de l'utilisateur"
);
String
firstname
=
scanner
.
next
();
System
.
out
.
println
(
"Nom de l'utilisateur"
);
String
lastname
=
scanner
.
next
();
System
.
out
.
println
(
"Age de l'utilisateur"
);
String
age
=
scanner
.
next
();
users
.
add
(
new
User
(
firstname
,
lastname
,
Integer
.
valueOf
(
age
)));
users
.
forEach
(
System
.
out
::
println
);
}
case
0
->
System
.
exit
(
0
);
default
->
System
.
out
.
println
(
"Mauvaise commande"
);
}
}
}
}
}
}
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