1. java语句介绍
- 注释语句:// 单行注释 /*...多行注释...*/ /**...文本注释...*/
- 可执行语句:

- 输入语句

2. 判断语句-if 以及 if else
if语句是java中常用的判断语句,基本结构:
if (判断条件){ .... // 输出结果或者进行其他操作 } | ||
实例:
public class Demo{
public static void main(String []args){
int a = 6;
if(a > 0){
System.out.println("a比0大哦");
}
}
}

if else 语句
语法:
if(布尔表达式){ //如果布尔表达式的值为true }else{ //如果布尔表达式的值为false } | |
实例:
public class Demo{
public static void main(String []args){
int a = 6;
if(a < 0){
System.out.println("a不小于0");
}else{
System.out.println("a比0大哦");
}
}
}
