摘要: 循环结构 while循环: do …… while循环 for循环 public class ForDemo1 { public static void main(String[] args) { int a = 1;//初始化条件 while (a<=100){ System.out.printl 阅读全文
posted @ 2021-09-17 20:03 京哈哈⁵²º(全国可飞) 阅读(67) 评论(0) 推荐(0)
摘要: 结构 选择结构 if单选择结构 public static void main(String[] args) { Scanner scanner = new Scanner(System.in); String s = scanner.nextLine(); //equals:判断字符串是否相等 i 阅读全文
posted @ 2021-09-17 18:54 京哈哈⁵²º(全国可飞) 阅读(55) 评论(0) 推荐(0)
摘要: Scanner对象 next对象()(输入单个单词) import java.util.Scanner; public class Demo1 { public static void main(String[] args) { //创建一个扫描器对象,用于接受键盘数据 Scanner scanne 阅读全文
posted @ 2021-09-17 18:52 京哈哈⁵²º(全国可飞) 阅读(18) 评论(0) 推荐(0)
摘要: 运算符 算术运算符 //二元运算符 //ctrl + d ;复制当前行到下一行 int a = 10; int b = 20; int c = 25; int d = 25; System.out.println(a+b);//30 System.out.println(a-b);//-10 Sys 阅读全文
posted @ 2021-09-17 18:50 京哈哈⁵²º(全国可飞) 阅读(34) 评论(0) 推荐(0)
摘要: 变量 //int a,b,c;(不建议) //int a = 1,b = 2,c = 3; int a = 1; int b = 2; int c = 3; String name = "jingyunfei"; char x = 'x'; double pi = 3.14; 变量作用域 publi 阅读全文
posted @ 2021-09-17 18:48 京哈哈⁵²º(全国可飞) 阅读(46) 评论(0) 推荐(0)
摘要: 类型转换 int i = 128; byte b = (byte)i;//内存溢出 //强制转化 (类型)变量名 高--低 //自动转换 低--高 System.out.println(i); System.out.println(b); 注意: 不能对布尔值进行转换 不能把对象类型住转换为不相干的 阅读全文
posted @ 2021-09-17 12:13 京哈哈⁵²º(全国可飞) 阅读(36) 评论(0) 推荐(0)