FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
hello-java/basic/c09_exceptions/ThrowExample.java at main · mouredev/hello-java · GitHub
mouredev
/
hello-java
Public
Notifications
You must be signed in to change notification settings
Fork
414
Star
4.5k
Code
Issues
0
Pull requests
3
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
hello-java
/
basic
/
c09_exceptions
/
ThrowExample.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
25 lines (21 loc) · 693 Bytes
Breadcrumbs
hello-java
/
basic
/
c09_exceptions
/
ThrowExample.java
Copy path
File metadata and controls
25 lines (21 loc) · 693 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
package
basic
.
c09_exceptions
;
/*
Clase 70 - Lanzamiento de excepciones
Vídeo: https://youtu.be/JOAqpdM36wI?t=28611
*/
public
class
ThrowExample
{
public
void
checkAge
(
int
age
)
throws
IllegalArgumentException
{
if
(
age
<
18
) {
throw
new
IllegalArgumentException
(
"Tienes que ser mayor de edad"
);
}
else
{
System
.
out
.
println
(
"Es mayor de edad"
);
}
}
public
void
checkScore
(
int
score
)
throws
CustomException
{
if
(
score
<
0
||
score
>
100
) {
throw
new
CustomException
(
"La puntuación debe estar entre 0 y 100"
);
}
else
{
System
.
out
.
println
(
"Puntuación válida: "
+
score
);
}
}
}
Back
|
FazBrowse Home
|
New Git URL