楼主啊,你是想让public void input() throws IOException
作为构造函数???构造函数是不带返回类型的,你这里怎么会
加上void呢???所以你这个input类的构造函数其实是调用的
默认构造函数。可以这么改inputwait类,调用input()方法:public class inputwait
{
public static void main(String[] args) throws Exception
{
input vv=new input();
vv.input();
}
}//--------------------
也可以修改public void input() throws IOException
为:public input() throws IOException
那就没问题了。
作为构造函数???构造函数是不带返回类型的,你这里怎么会
加上void呢???所以你这个input类的构造函数其实是调用的
默认构造函数。可以这么改inputwait类,调用input()方法:public class inputwait
{
public static void main(String[] args) throws Exception
{
input vv=new input();
vv.input();
}
}//--------------------
也可以修改public void input() throws IOException
为:public input() throws IOException
那就没问题了。
public class Inputwait
{
public static void main(String[] args)
{
Input vv=new Input();
try{
vv.input();
}catch(IOException ioe){
System.out.println(ioe.getMessage());
}
}
}也可以修改public void input() throws IOException
为:public input() throws IOException
这样写会报 invalid method declaration; return type required的错误