摘要:
在包a中新建一个类A,在类A中有一个int add(int m)方法,用来求1+2+…+m 的和。在包b中新建一个类B,在类B中有一个int cheng(int n)方法,用来求n! 的结果。在包c中新建一个主类C,调用A、B中的方法输出1+2+…+30的和, 以及5!的计算结果。 阅读全文
posted @ 2016-05-19 21:11
╄承诺、带给的伤痛—
阅读(154)
评论(0)
推荐(0)
摘要:
在包a中编写一个类Father,具有属性:年龄(私有)、姓名(公有); 具有功能:工作(公有)、开车(公有)。 在包a中编写一个子类Son,具有属性:年龄(受保护的)、姓名; 具有功能:玩(私有)、学习(公有)。 最后在包b中编写主类Test,在主类的 方法中测试类Father与类Son。 最后输出 阅读全文
posted @ 2016-05-19 20:41
╄承诺、带给的伤痛—
阅读(174)
评论(0)
推荐(0)
摘要:
package pack1; public class A { private int i; float f; public double d; } package pack1; public class B { public static void main(String[] args) { A a = new A()... 阅读全文
posted @ 2016-05-19 20:35
╄承诺、带给的伤痛—
阅读(140)
评论(0)
推荐(0)
摘要:
package lianxiti; public class Cat { private String name; private String color; private int age; public String getName() { return name; } public void 阅读全文
posted @ 2016-05-19 18:01
╄承诺、带给的伤痛—
阅读(212)
评论(0)
推荐(0)
摘要:
package lianxiti; public class Print { void output(int x) { if(x==1) { System.out.println("ABCDEFGHIJKLMNOPQRSTUVWXYZ"); } else if(x==2) { System.out. 阅读全文
posted @ 2016-05-19 16:39
╄承诺、带给的伤痛—
阅读(763)
评论(0)
推荐(0)
摘要:
package lianxiti; public class Clock { int shi; int fen; int miao; Clock(int shi,int fen,int miao) { this.shi=shi; this.fen=fen; this.miao=miao; } voi 阅读全文
posted @ 2016-05-19 16:30
╄承诺、带给的伤痛—
阅读(166)
评论(0)
推荐(0)