摘要: 程序特点:构造方法私有化,在类的内部定义static属性和方法,利用static方法取得本类的实例化对象,这样一来不管外部会产生多少个Singleton对象,但本质上只有唯一一个实例化对象。 阅读全文
posted @ 2016-10-09 15:20 as145 阅读(74) 评论(0) 推荐(0) 编辑
摘要: 1 interface A 2 {public void get(); 3 } 4 class B implements A 5 {public void get(){ 6 System.out.println("出席活动"); 7 } 8 } 9 class C implements A 10 {private A a; 11 public C(A a){ 12 ... 阅读全文
posted @ 2016-09-27 17:26 as145 阅读(110) 评论(0) 推荐(0) 编辑
摘要: 1 interface A 2 {public void fintr(); 3 } 4 class B implements A 5 {public void fintr(){ 6 System.out.println("666"); 7 } 8 } 9 class C implements A 10 {public void fintr(){ 11 Sys... 阅读全文
posted @ 2016-09-27 17:10 as145 阅读(113) 评论(0) 推荐(0) 编辑
摘要: 1 abstract class Action { 2 public static final int ECT=1; 3 public static final int WROLD=2; 4 public static final int Sleep=7; 5 public void cmmand(int fag){ 6 switch (fag) 7 { ... 阅读全文
posted @ 2016-09-24 15:42 as145 阅读(326) 评论(0) 推荐(0) 编辑
摘要: 1 class Province { 2 private int pid; 3 private String name; 4 private Stata stata; 5 private City citys [] ; 6 public void setStata(Stata stata){ 7 this.stata... 阅读全文
posted @ 2016-09-15 17:13 as145 阅读(922) 评论(0) 推荐(0) 编辑
摘要: 1 class Province { 2 private int pid; 3 private String name; 4 private City citys [] ; 5 public void setCitys(City citys[]){ 6 this.citys=citys; 7 } 8 阅读全文
posted @ 2016-09-15 10:50 as145 阅读(176) 评论(0) 推荐(0) 编辑
摘要: ①实现基本字段的转换: class Emp { private String ename; private int empno; private double sal; private double comm; private String job; //set.get略 public Emp() 阅读全文
posted @ 2016-09-12 22:01 as145 阅读(126) 评论(0) 推荐(0) 编辑
摘要: class emp {private int empno ; private String ename; private String job ; private double sal ; public emp(){ this(1,"张三","前台",100); } public emp (int empno){ this(empno,"李四","后台",2000);... 阅读全文
posted @ 2016-09-08 17:44 as145 阅读(101) 评论(0) 推荐(0) 编辑
摘要: public class first {public static void main(String args[]){ String asd = "helloworld"; String asf = "hello world love"; System.out.println(asd.contains("hello"));//判断“hello”是否存在 Syste... 阅读全文
posted @ 2016-09-07 19:55 as145 阅读(112) 评论(0) 推荐(0) 编辑
摘要: ( 字符与字符串 )2016-09-0118:05:00 阅读全文
posted @ 2016-09-01 18:06 as145 阅读(160) 评论(0) 推荐(0) 编辑