摘要: 例 9.4对象数组 1 public class cjava { 2 public static void main(String[] args) { 3 Box a[]= {new Box(10,12,15),new Box(15,18,20),new Box(16,20,26)}; 4 Syst 阅读全文
posted @ 2020-08-26 19:44 敲敲代代码码 阅读(93) 评论(0) 推荐(0) 编辑
摘要: 例9.3 析构函数 1 public class cjava { 2 public static void main(String[] args) { 3 Student s1=new Student(10010,"wang ba",'f'); 4 s1.display(); 5 Student s 阅读全文
posted @ 2020-08-25 17:37 敲敲代代码码 阅读(155) 评论(0) 推荐(0) 编辑
摘要: 例 9.2双构造函数 1 public class cjava { 2 public static void main(String[] args) { 3 Box b1=new Box(); 4 System.out.println("The volume of box1 is "+b1.volu 阅读全文
posted @ 2020-08-24 21:17 敲敲代代码码 阅读(153) 评论(0) 推荐(0) 编辑
摘要: 例9.1构造函数 1 import java.util.Scanner; 2 import java.lang.*; 3 public class cjava { 4 public static void main(String[] args) { 5 Time t1= new Time(); 6 阅读全文
posted @ 2020-08-23 16:13 敲敲代代码码 阅读(71) 评论(0) 推荐(0) 编辑
摘要: 例8.4找出整型数组的最大值 1 import java.util.Scanner; 2 public class cjava { 3 public static void main(String[] args) { 4 Array t = new Array(); 5 t.set_value(); 阅读全文
posted @ 2020-08-22 19:09 敲敲代代码码 阅读(67) 评论(0) 推荐(0) 编辑
摘要: 例8.3 1 import java.util.Scanner; 2 import java.lang.*; 3 public class cjava { 4 public static void main(String[] args) { 5 Time t = new Time(); 6 t.se 阅读全文
posted @ 2020-08-21 17:20 敲敲代代码码 阅读(64) 评论(0) 推荐(0) 编辑
摘要: 例8.1类的简单例子 1 public class cjava { 2 public static void main(String[] args) { 3 Time t = new Time(); 4 Scanner s=new Scanner(System.in); 5 t.hour=s.nex 阅读全文
posted @ 2020-08-20 20:19 敲敲代代码码 阅读(97) 评论(0) 推荐(0) 编辑
摘要: 例5.7三个字符串求最大者 1 public class cjava { 2 public static void main(String[] args) { 3 System.out.println("输入三个国家的名字:"); 4 Scanner s = new Scanner(System.i 阅读全文
posted @ 2020-08-19 21:57 敲敲代代码码 阅读(88) 评论(0) 推荐(0) 编辑
摘要: 例5.4二维数组 1 public class cjava { 2 public static void main(String[] args) { 3 int i,j; 4 int[][] a={{1,2,3},{4,5,6}}; 5 int[][] b=new int[3][2]; 6 Syst 阅读全文
posted @ 2020-08-18 21:58 敲敲代代码码 阅读(113) 评论(0) 推荐(0) 编辑
摘要: 例5.1数组引用 public class cjava { public static void main(String[] args) { int i; int[] a=new int[10]; for(i=0;i<=9;i++) { a[i]=i; } for(i=9;i>=0;i--) { S 阅读全文
posted @ 2020-08-17 13:16 敲敲代代码码 阅读(124) 评论(0) 推荐(0) 编辑