摘要: 升级版 长方形的面积为:50 阅读全文
posted @ 2018-01-04 21:47 振华213 阅读(477) 评论(0) 推荐(0) 编辑
摘要: package com.imooc.method; public class MethodDemo { // 打印输出星号的方法 //3、执行方法体中的语句 //6 public void printStar() { System.out.println("*******************************"); } public static void main... 阅读全文
posted @ 2018-01-04 20:13 振华213 阅读(570) 评论(0) 推荐(0) 编辑
摘要: 在一个二维数组中存放了三名学生的语文和数学的成绩,从键盘输入三名学生的成绩存储到二维数组中,分别求语文和数学的总成绩及平均分并输出。 //定义一个三行两列的整型二维数组intArray int score[][]=new int[3][2]; //从键盘输入学生成绩,要求输入顺序与效果图一致 for 阅读全文
posted @ 2017-12-28 22:44 振华213 阅读(1944) 评论(0) 推荐(0) 编辑
摘要: 1 package com.imooc.array; 2 3 public class SortDemo2 { 4 5 public static void main(String[] args) { 6 //定义一个字符数组并初始化,统计字符'a'或'A'出现的次数 7 //定义一个字符数组ch并初始化 8 char[... 阅读全文
posted @ 2017-12-26 21:22 振华213 阅读(1564) 评论(0) 推荐(0) 编辑
摘要: package com.imooc.array; public class SortDemo { public static void main(String[] args) { //冒泡排序 int[] a={34,53,12,32,56,17}; System.out.println("排序前的数组元素为:"); for(int n:a){ System.out.... 阅读全文
posted @ 2017-12-26 16:58 振华213 阅读(161) 评论(0) 推荐(0) 编辑
摘要: 同理求最小值、键盘输入值最值 阅读全文
posted @ 2017-12-26 16:18 振华213 阅读(488) 评论(0) 推荐(0) 编辑
摘要: package com.imooc.array; public class ArrayDemo2 { public static void main(String[] args) { //定义一个整型数组,并初始化 int[] a=new int[15]; //循环遍历数组,找出能被3整除的元素并打印输出 for(int i=0;i<15;i++){ a[i]=i+... 阅读全文
posted @ 2017-12-26 16:08 振华213 阅读(2464) 评论(0) 推荐(0) 编辑
摘要: 输出效果: 阅读全文
posted @ 2017-12-22 16:53 振华213 阅读(1330) 评论(0) 推荐(0) 编辑
摘要: public class JieChengPlus { public static void main(String[] args) { //求1!+2!+3!+4!+5!+6!+7!+8!+9!+10! int jiecheng=1; int count=0; for(int s=1;s<=4;s++){ jiecheng=1; for(int k=1;k<=s... 阅读全文
posted @ 2017-12-22 16:02 振华213 阅读(255) 评论(0) 推荐(0) 编辑
摘要: //while-if嵌套 /*char n='*'; int m=1; System.out.println("==输出10行10列的星号=="); while(m<101){ System.out.print(n+" "); if(m%10==0){ System.out.println(); } m++; */ //whil... 阅读全文
posted @ 2017-12-22 11:33 振华213 阅读(3559) 评论(0) 推荐(0) 编辑