摘要: 在包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)
摘要: public class Account { String zhanghu; double cunkuanyue; //先初始化 Account(String zhanghu,double cunkuanyue) { this.zhanghu=zhanghu; this.cunkuanyue=cunkuanyue; ... 阅读全文
posted @ 2016-05-18 14:20 ╄承诺、带给的伤痛— 阅读(323) 评论(0) 推荐(0)
摘要: package com.hanqi; public class shuixianhuashu { //输出100-999之间的水仙花数 public static void main(String[] args) { for(int i=1;i<10;i++) { for(int j=0;j<10; 阅读全文
posted @ 2016-05-17 16:13 ╄承诺、带给的伤痛— 阅读(904) 评论(0) 推荐(0)
摘要: 第一种方法;对象初始化。 第二中方法,在主类的main方法中创建多个Student类的对象,使用这些对象来测 阅读全文
posted @ 2016-05-17 15:40 ╄承诺、带给的伤痛— 阅读(262) 评论(0) 推荐(0)
摘要: 这是梯形的部分 这是园的部分 用A 来测试 阅读全文
posted @ 2016-05-17 09:10 ╄承诺、带给的伤痛— 阅读(1090) 评论(0) 推荐(0)