请阅读下面程序 import java.io.*; public class ExceptionCatch { public static void main(String args[]) { try{ FilelnputStream fis=new FilelnputStream("text"); System.out.println("content of text is:"); } catch(FileNotFoundException e) { System.out.println(e); System.out.println("message:"+e.getMessageO); e.printStackTrace(System.out); }____{ System.out.println(e); } } } 为保证程序正确运行,程序中下划线处的语句应是
A.catch(FilelnputStream fis)
B.e.printStackTrace()
C.catch(IOException e)
D.System.out.println(e)
第1题:
已知类 String 的原型为
class string
{
public:
string(const char *str=null);//普通构造函数
string(const string &other);//拷贝构造函数
---string(void);
string &operate=(const string &other);//赋值函数
private:
char * m-data;//用于保存字符串
};
请编写 string 的上述4 个函数
第2题:
第3题:
以下叙述正确的是()。
A.main方法必须是public方法
B.构造方法必须是public方法
C.Java应用程序的文件名可以是任意的
D.构造方法应该声明为void类型
第4题:
请写出下面的输出:
class B
{
public:
virtual void Print(void)
{
printf(“B::Print\n”);
}
virtual void Reprint(void)
{
printf(“B:Reprint\n”);
}
void Algo(void)
{
Print();
Reprint();
}
};
class D : public B
{
public:
virtual void Print(void)
{
printf(“D::Print\n”);
}
};
void main()
{
B *p = new D();
p->Print();
p->Algo();
}
第5题:
第6题:
以下叙述正确的是()
A.main方法必须是public方法
B.构造方法必须是public方法
C.Java应用程序的文件名可以是任意的
D.构造方法应该声明为void类型