摘要: public class Homework06 { void test1(int a,int b){ int t ,i,m,n; m=a; n=b; if(a<b){ t=a; a=b; b=t; } while(a%b!=0){ t=a%b; a=b; b=t; } System.out.prin 阅读全文
posted @ 2017-03-26 22:18 我为编程上架构 阅读(427) 评论(0) 推荐(0) 编辑
摘要: public class Homework07 { void test2 (int a){ int t,x=0,i; for(i=1;i<=4;i++){ t=a%10; a=a/10; x=x+t; } System.out.println("四位数的各位数和为"+x); }} import ja 阅读全文
posted @ 2017-03-26 22:17 我为编程上架构 阅读(903) 评论(0) 推荐(0) 编辑
摘要: 郑州大学——徐峰 类方法: public class Homework08 { void test3 (int a){ int t,i,x=0; for(i=1;i<=5;i++){ t=a%10; a=a/10; x=x*10+t; } System.out.print(x); }} 主方法: i 阅读全文
posted @ 2017-03-26 22:15 我为编程上架构 阅读(1295) 评论(0) 推荐(0) 编辑
摘要: 郑州大学——徐峰 类: public class Homework09 { void test3 (int a){ int t,i,x=0,y; y=a; for(i=1;i<=5;i++){ t=a%10; a=a/10; x=x*10+t; } if(x==y){ System.out.prin 阅读全文
posted @ 2017-03-26 22:12 我为编程上架构 阅读(581) 评论(0) 推荐(0) 编辑
摘要: JAVA中类与对象的概念 把客观世界中的事物映射到面向对象的程序设计中就是对象。对象是面向对象程序设计中用来描述客观事物的程序单位。客观世界中的许多对象,无论其属性还是其行为常常有许多共同性,抽象出这些对象的共同性便可以构成类。所以,类是对象的抽象和归纳,对象是类的实例。 一、抽象原则 所谓抽象(a 阅读全文
posted @ 2017-03-26 16:05 我为编程上架构 阅读(226) 评论(0) 推荐(0) 编辑
摘要: 请按 目的 Ctrl + C 复制。 Ctrl + X 剪切。 Ctrl + V 粘贴。 Ctrl + Z 撤消。 DELETE 删除。 Shift + Delete 永久删除所选项,而不将它放到“回收站”中。 拖动某一项时按 CTRL 复制所选项。 拖动某一项时按 CTRL + SHIFT 创建所 阅读全文
posted @ 2017-03-24 20:18 我为编程上架构 阅读(259) 评论(0) 推荐(0) 编辑
摘要: void是无返回值的意思。比方说 public void walk() { System.out.print("你好!"); }如果别的地方调用这个方法 就会打印出 你好!再看这里: public String walk() //注意这里的返回类型是String不是void了 { System.ou 阅读全文
posted @ 2017-03-24 16:44 我为编程上架构 阅读(216) 评论(0) 推荐(0) 编辑
摘要: 1个1个拿正好拿完。 2个2个拿还剩1个。 3个3个拿正好拿完。 4个4个拿还剩1个。 5个5个拿还剩4个。 6个6个拿还剩3个。 7个7个拿还剩5个。 8个8个拿还乘1个。 9个9个拿正好拿完。 问筐里有多少鸡蛋? class Homework{ public static void main(S 阅读全文
posted @ 2017-03-23 10:46 我为编程上架构 阅读(125) 评论(0) 推荐(0) 编辑
摘要: //break是结束整个循环体,continue是结束单次循环比方说:while(x++ < 10){ if(x == 3) { break; } printf("%d\r\n", x);}结果是输出 1 2 就退出了整个while循环但是如果使用continuewhile(x++ < 10){ i 阅读全文
posted @ 2017-03-23 10:44 我为编程上架构 阅读(604) 评论(0) 推荐(0) 编辑
摘要: 求1 100里,能被3整除或者能被4整除的数的和 class Homework{ public static void main(String[] args){ int t=0; for(int i=0;i<=100;i++){ if(i%3==0||i%4==0){ t=t+i;} }System 阅读全文
posted @ 2017-03-23 10:41 我为编程上架构 阅读(146) 评论(0) 推荐(0) 编辑