程序修改如下:import java.util.*;//因为你调用了Date类型public interface Plan{

/**
must notice:
1 cat't use public,private and protected for the attributes
2 must give a initial value for the parametersprivate
*/

// private constructor
/*private Plan();这句话去掉,接口是不能够有构造函数的。
         
         //private Plan();

// basic info.
 String planID = null;
 String planName = null;

// time for begin and time for end
 Date dateBegin = null;
 Date dateEnd = null; 

// result of the plan, 0 for fail ; 1 for accomplish
String result = null;

public String getPlanID();
public void setPlanID(String planID);

public String getPlanName() ;
public void   setPlanName(String PlanName) ;



// 取得一个plan的实例 不使用new来构造
public Plan getInstance();
}//祝你好运!

解决方案 »

  1.   

    1、接口是逻辑对象的抽象,通常不定义其构造函数,一般是将实现它的对象的实例赋给它。
    2、你定义这个接口的目的是什么?看上去象个class
    3、接口中只能定义static的变量,普通变量是不能被定义的,你的这个文件应该是没法编译通过的
      

  2.   

    to :wks9527(空值异常) 
    程序能够编译过去,我一直也认为接口里面应当是static的变量,但是那个程序我看过了,能够编译过去,而且我反编译了class文件才发现,原来jdk已经为我们定义了static变量。
    也就是说,如果我们在接口中不写static标志的话,虚拟机会自动为我们添加!to: asiaec (星星是你看我的眼睛)  /*private Plan();这句话去掉,接口是不能够有构造函数的。
    应给为
    /*private Plan();这句话去掉,接口是不能够有构造函数的。*/
    对不起,写错了!望谅解!祝你好运!
      

  3.   

    是的,接口中一般不定义变量,如果定义了也只是申明常量,就是所谓的常量接口。你们看看下面的这篇文章吧:
    http://www-900.ibm.com/developerWorks/cn/java/l-java-interface/index.shtml