上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 39 下一页
摘要: 可变个数形参的格式:数据类型 ...变量名 当调用可变个数形参的方法时,传入的参数个数可以是:0个,1个,2个,,,, 可变个数形参的方法与本类中方法名相同,形参不同的方法之间构成重载 可变个数形参的方法与本类中方法名相同,形参类型也相同的数组之间不构成重载。也就是二者不能共存。 可变个数形参在方法 阅读全文
posted @ 2022-01-08 14:48 ice--cream 阅读(61) 评论(0) 推荐(0) 编辑
摘要: 重载的概念:在同一个类中,允许存在一个以上的同名方法,只要他们的参数个数或者参数类型不同即可。 package lll; public class Test { public static void main(String[] args) { OverLoad ol=new OverLoad(); 阅读全文
posted @ 2022-01-08 14:14 ice--cream 阅读(31) 评论(0) 推荐(0) 编辑
摘要: package lll; public class Test { public static void main(String[] args) { int[] arr=new int[]{-11,2,3,23,434,-122,29,7,16}; ArrayUtil util=new ArrayUt 阅读全文
posted @ 2022-01-08 12:40 ice--cream 阅读(131) 评论(0) 推荐(0) 编辑
摘要: 含义:创建的对象,没有显式的赋给一个变量名,即为匿名对象 注意:匿名对象只能调用一次 package lll; public class Test { public static void main(String[] args) { Phone p1=new Phone(); p1.sendEmai 阅读全文
posted @ 2022-01-08 11:30 ice--cream 阅读(34) 评论(0) 推荐(0) 编辑
摘要: package lll; public class Test { public static void main(String[] args) { Student[] stu=new Student[20]; for(int i=0;i<stu.length;i++){ stu[i]=new Stu 阅读全文
posted @ 2022-01-06 18:14 ice--cream 阅读(41) 评论(0) 推荐(0) 编辑
摘要: package lll; public class Test { public static void main(String[] args) { Test a=new Test(); a.method(); } public void method(){ for(int i=0;i<10;i++) 阅读全文
posted @ 2022-01-06 16:20 ice--cream 阅读(77) 评论(0) 推荐(0) 编辑
摘要: package lll; public class Test { public static void main(String[] args) { Circle c1=new Circle(); c1.radius=2; System.out.println(c1.findArea()); } } 阅读全文
posted @ 2022-01-06 15:55 ice--cream 阅读(388) 评论(0) 推荐(0) 编辑
摘要: 方法:描述类应该具有的功能 方法的声明: 权限修饰符 返回值类型 方法名(形参列表){ ​ 方法体 ​ } 简单类示范: package lll; public class Test { public static void main(String[] args) { Person p1=new P 阅读全文
posted @ 2022-01-06 15:41 ice--cream 阅读(171) 评论(0) 推荐(0) 编辑
摘要: 相同点 定义变量的格式相同,数据类型 变量名=变量值 先声明,后使用 都有其对应的作用域 不同点 在类中声明的位置不同 属性:直接定义在类的一对{}内 局部变量:声明在方法内、方法形参、代码块内、构造器形参、构造器内部的变量 关于权限修饰符的不同 属性:可以在声明属性时,指明其权限,使用权限修饰符。 阅读全文
posted @ 2022-01-06 12:31 ice--cream 阅读(51) 评论(0) 推荐(0) 编辑
摘要: 属性:对应类中的成员变量 行为:对应类中的成员方法 package lll; public class Test { public static void main(String[] args) { Person p1=new Person(); p1.name="lll"; p1.age=11; 阅读全文
posted @ 2022-01-06 10:39 ice--cream 阅读(22) 评论(0) 推荐(0) 编辑
上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 39 下一页