摘要: public class DoWileDemo01 { public static void main(String[] args) { int i = 0; int sum = 0; do { sum = sum + i; i++; }while (i<= 100); System.out.pri 阅读全文
posted @ 2022-07-11 18:50 jy饺子 阅读(31) 评论(0) 推荐(0)
摘要: public class WhileDemo01 { public static void main(String[] args) { //输出1-100 int i = 0; while (i < 100){ i++; System.out.println(i); } }} public clas 阅读全文
posted @ 2022-07-11 18:43 jy饺子 阅读(29) 评论(0) 推荐(0)
摘要: public class Demo04 { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); //从键盘接收数据 int i = 0; float f = 0.0f; System.o 阅读全文
posted @ 2022-07-10 10:35 jy饺子 阅读(23) 评论(0) 推荐(0)
摘要: /*next不可以得到带空格的字符串 读取的是单个字符串 */public class Demo01 { public static void main(String[] args) { //创建一个扫描器的对象,用于接受键盘数据 Scanner scanner = new Scanner(Syst 阅读全文
posted @ 2022-07-10 10:00 jy饺子 阅读(33) 评论(0) 推荐(0)
摘要: public class Demo07 { public static void main(String[] args) { int a = 10; int b = 20; a += b; a -= b; System.out.println(a); //字符串连接符 + , String Syst 阅读全文
posted @ 2022-07-09 10:59 jy饺子 阅读(19) 评论(0) 推荐(0)
摘要: public class Demo03 { public static void main(String[] args) { //关系运算符返回的结果:正确,错误 布尔值\ //if int a = 10; int b = 20; int c = 21; System.out.println(c%a 阅读全文
posted @ 2022-07-09 10:52 jy饺子 阅读(35) 评论(0) 推荐(0)
摘要: public class Demo01 { public static void main(String[] args) { //二元运算符 int a = 10; int b = 20; int c = 30; int d = 40; System.out.println(a+b); System 阅读全文
posted @ 2022-07-09 10:51 jy饺子 阅读(32) 评论(0) 推荐(0)
摘要: public class Demo07 { public static void main(String[] args) {// int a ,b,c;// int a = 1, b=2 , c=3;//程序可读性 String name = "jiaozi"; char x = 'X'; doub 阅读全文
posted @ 2022-07-09 08:18 jy饺子 阅读(46) 评论(0) 推荐(0)
摘要: public class Demo05 { public static void main(String[] args) { int i = 128; byte b = (byte) i;//内存溢出 byte大于128 //强制转换 (类型)变量名 System.out.println(b); / 阅读全文
posted @ 2022-07-08 17:11 jy饺子 阅读(6) 评论(0) 推荐(0)
摘要: public class Demo03 { public static void main(String[] args) { //整数拓展: 进制 二进制0b 十进制 八进制0 十六进制0x int i = 10; int i2 = 010; //八进制 int i3 = 0x10; //十六进制 阅读全文
posted @ 2022-07-07 22:29 jy饺子 阅读(25) 评论(0) 推荐(0)