FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
JavaExercises/Java 1/J1Lesson3.java at master · biblelamp/JavaExercises · GitHub
biblelamp
/
JavaExercises
Public
Notifications
You must be signed in to change notification settings
Fork
130
Star
153
Code
Issues
1
Pull requests
9
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
JavaExercises
/
Java 1
/
J1Lesson3.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
31 lines (27 loc) · 918 Bytes
Breadcrumbs
JavaExercises
/
Java 1
/
J1Lesson3.java
Copy path
File metadata and controls
31 lines (27 loc) · 918 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import
java
.
util
.
Arrays
;
import
java
.
util
.
Random
;
import
java
.
util
.
Scanner
;
class
J1Lesson3
{
public
static
void
main
(
String
[]
args
) {
int
[]
arr
= {
6
,
4
,
9
,
2
,
3
,
7
,
0
};
System
.
out
.
println
(
Arrays
.
toString
(
arr
));
Arrays
.
sort
(
arr
);
System
.
out
.
println
(
Arrays
.
toString
(
arr
));
System
.
out
.
println
(
arr
[
0
] +
" - "
+
arr
[
arr
.
length
-
1
]);
Random
random
=
new
Random
();
for
(
int
i
=
0
;
i
<
20
;
i
++) {
System
.
out
.
print
(
random
.
nextInt
(
25
) +
" "
);
}
System
.
out
.
println
(
"
\n
Enter a operation b:"
);
Scanner
read
=
new
Scanner
(
System
.
in
);
int
a
=
read
.
nextInt
();
String
s
=
read
.
next
();
int
b
=
read
.
nextInt
();
switch
(
s
) {
case
"+"
:
System
.
out
.
println
(
"= "
+ (
a
+
b
));
break
;
case
"-"
:
System
.
out
.
println
(
"= "
+ (
a
-
b
));
break
;
}
}
}
Back
|
FazBrowse Home
|
New Git URL