2 Star 0 Fork 0

热门极速下载/hello-java

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
Conditionals.java 1.21 KB
一键复制 编辑 原始数据 按行查看 历史
package basic.c04_conditionals;
/*
Clase 35 - Condicionales
Vídeo: https://youtu.be/JOAqpdM36wI?t=9908
*/
public class Conditionals {
public static void main(String[] args) {
// Condicionales
/*
Clase 36 - Sentencia if
Vídeo: https://youtu.be/JOAqpdM36wI?t=9978
*/
// if, else if, else
var age = 18;
System.out.println(age >= 18);
if (age > 18) {
System.out.println("El usuario es mayor de edad");
} else if (age == 18) {
System.out.println("El usuario acaba de cumplir 18");
} else {
System.out.println("El usuario es menor de edad");
}
/*
Clase 37 - Sentencia switch
Vídeo: https://youtu.be/JOAqpdM36wI?t=10678
*/
// switch
var day = 5;
switch (day) {
case 1:
System.out.println("Lunes");
break;
case 2:
System.out.println("Martes");
break;
case 3:
System.out.println("Miércoles");
break;
default:
System.out.println("No es lunes, martes o miércoles");
}
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mirrors_trending/hello-java.git
git@gitee.com:mirrors_trending/hello-java.git
mirrors_trending
hello-java
hello-java
main

搜索帮助