摘要:
程序特点:构造方法私有化,在类的内部定义static属性和方法,利用static方法取得本类的实例化对象,这样一来不管外部会产生多少个Singleton对象,但本质上只有唯一一个实例化对象。 阅读全文
摘要:
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 ... 阅读全文
摘要:
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... 阅读全文
摘要:
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 { ... 阅读全文
摘要:
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... 阅读全文
摘要:
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 阅读全文
摘要:
①实现基本字段的转换: class Emp { private String ename; private int empno; private double sal; private double comm; private String job; //set.get略 public Emp() 阅读全文
摘要:
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);... 阅读全文
摘要:
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... 阅读全文