摘要: package method;public class Demo03 { public static void main(String[] args) { Demo03 demo03 = new Demo03(); demo03.test(1,2,3); } //int...(可变参数) 一个方法中 阅读全文
posted @ 2022-03-25 16:58 白糖11 阅读(15) 评论(0) 推荐(0)
摘要: package method;//方法定义调用public class Demo02 { public static void main(String[] args) { double max = max(20,10); System.out.println(max); } //方法的重载: //1 阅读全文
posted @ 2022-03-25 16:57 白糖11 阅读(22) 评论(0) 推荐(0)
摘要: package method;public class Demo06 { //递归用法 能不用递归就不用 只能用于小计算 public static void main(String[] args) { System.out.println(f(4)); } public static int f( 阅读全文
posted @ 2022-03-25 16:56 白糖11 阅读(23) 评论(0) 推荐(0)
摘要: package struct;public class ForDemo05 { public static void main(String[] args) { //增强for循环 int[] numbers = {10,20,30,40,50};//定义了一个数组 for (int x:numbe 阅读全文
posted @ 2022-03-25 16:51 白糖11 阅读(38) 评论(0) 推荐(0)
摘要: package struct;public class switchDemo02 { public static void main(String[] args) { //JDK7开始switch支持表达结果为字符串!!! //字符的本质还是数字 //反编译 java class(字节码文件) 反编 阅读全文
posted @ 2022-03-25 16:48 白糖11 阅读(26) 评论(0) 推荐(0)
摘要: package struct;public class DoWhileDemo01 { public static void main(String[] args) { int i = 0; int sum = 0; do { sum = sum+i; i++; }while (i<=100); S 阅读全文
posted @ 2022-03-25 16:43 白糖11 阅读(174) 评论(0) 推荐(0)
摘要: public class Demo05 { public static void main(String[] args) { //我们可以输入多个文字,并求其总和与平均数,每输入一个数字用回车确认,通过输入非数字来结束输入并输出执行结果: Scanner scanner = new Scanner( 阅读全文
posted @ 2022-03-25 16:39 白糖11 阅读(29) 评论(0) 推荐(0)