摘要: #数组 ##数组定义和基本使用 public static void main(String[] args) { int[] nums; //1.声名一个数组 nums = new int[10];//创建一个数组 //int[] nums = new int[10]; 效果等于上面2句 //3.给 阅读全文
posted @ 2022-02-17 14:51 小幼虫虫 阅读(33) 评论(0) 推荐(0)
摘要: #可变参数 //可变参数 public static void main(String[] args) { Demo03 demo03 = new Demo03(); demo03.test(1, 2, 3, 4, 45); } //可变参数只能有1个,只能放到后面 public void test 阅读全文
posted @ 2022-02-17 13:59 小幼虫虫 阅读(18) 评论(0) 推荐(0)
摘要: public class Demo02 { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("请输入第一个数据"); double result 阅读全文
posted @ 2022-02-16 17:50 小幼虫虫 阅读(261) 评论(0) 推荐(0)
摘要: ##方法 System.out.println() (类).(对象).(方法) 命明规则:首字母小写,后面单词大写(驼峰规则) 教学视频 ##方法重载 阅读全文
posted @ 2022-02-16 15:33 小幼虫虫 阅读(29) 评论(0) 推荐(0)
摘要: #Break和Continue ##break 在循环中,直接打破退出循环 在switch中,选择执行,防止穿透 //输出了1-9 public static void main(String[] args) { int i = 0; while (i < 50) { i++; if (i % 10 阅读全文
posted @ 2022-02-16 14:57 小幼虫虫 阅读(37) 评论(0) 推荐(0)
摘要: #for循环 表达式 package com.struct; //for public class ForDemo { public static void main(String[] args) { //计算1-100的奇数和,偶数和 int evensum = 0; int oddsum = 0 阅读全文
posted @ 2022-02-14 19:04 小幼虫虫 阅读(50) 评论(0) 推荐(0)
摘要: #whlie和if...else 和 switch()case()break ##if...else package com.scanner; import java.util.Scanner; //if判断 public class Demo01 { public static void main 阅读全文
posted @ 2022-02-14 15:05 小幼虫虫 阅读(44) 评论(0) 推荐(0)
摘要: ##Next和NextLine ###next //输入"嘻嘻 哈哈",输出为"嘻嘻" import java.util.Scanner; public class NextOfScanner { public static void main(String[] args) { Scanner sc 阅读全文
posted @ 2022-02-13 17:39 小幼虫虫 阅读(53) 评论(0) 推荐(0)
摘要: #运算符:一元,二元,三元,逻辑 ##二元运算符 package com.base02; //运算符 public class Demo01 { public static void main(String[] args) { //二元运算符 //Ctrl + D :复制当前行到下一行 int a= 阅读全文
posted @ 2022-02-13 15:16 小幼虫虫 阅读(290) 评论(0) 推荐(0)
摘要: ## 变量常量 //类变量 static //实例变量在类里面 //局部变量在方法里面 package com.liu; public class Demo04 { //类变量static static double salary = 2500; //常量 final //修饰符,不存在先后顺序 s 阅读全文
posted @ 2022-02-12 16:10 小幼虫虫 阅读(49) 评论(0) 推荐(0)