随笔分类 -  02_java基础_相关例题

摘要:1.判断程序输出的结果 1 public class ReturnExceptionDemo { 2 static void methodA() { 3 try { 4 System.out.println("进入方法A"); 5 throw new RuntimeException("制造异常") 阅读全文
posted @ 2022-04-12 16:19 默以思道 阅读(118) 评论(0) 推荐(0)
摘要:1.static关键字的使用 1.1求圆的面积 1 /* 2 * 求圆的面积 3 * 属性 :半径/id/创建园的个数,需要考虑类变量 4 * 方法 : 5 */ 6 7 public class CircleTest { 8 public static void main(String[] arg 阅读全文
posted @ 2022-04-08 23:06 默以思道 阅读(24) 评论(0) 推荐(0)
摘要:1/定义类Student,包含三个属性:学号number(int),年级state(int),成绩score(int)。 创建20个学生对象,学号为1到20,年级和成绩都由随机数确定。 问题一:打印出3年级(state值为3)的学生信息。 问题二:使用冒泡排序按学生成绩排序,并遍历所有学生信息 1 阅读全文
posted @ 2022-03-20 22:53 默以思道 阅读(70) 评论(0) 推荐(0)
摘要:1 class Nine_NineTable 2 { 3 public static void main(String[] args) 4 { 5 for (int i = 1;i <=9 ;i++ ) 6 { 7 for(int j = 1; j <= i ;j++) 8 { 9 System.o 阅读全文
posted @ 2022-03-16 16:30 默以思道 阅读(37) 评论(0) 推荐(0)