摘要: 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) 编辑