请大家看一看JAVA程序出了甚麽毛病?

来源:百度知道 编辑:UC知道 时间:2024/05/27 03:09:47
import java.io.*;
class mainclass
{ public static void throwexception()throws Exception
{
Exception ee;
ee=new Exception("This is a sample of Exception");
throw ee;
}
public static void main(String args[])throws Throwable
{
FileOutputStream FileIn=new FileOutputStream("d;\\exception.txt");
PrintStream pp=nex PrintStream(FileIn);
try
{
throwexception();
}
catch(Exception e)
{
system.out.println(e);
system.out.println(e.toString());
system.out.println(e.getMessage());
e.printStackTrace();
e.printStackTrace(pp);

这是我改过的.编译通过.没问题.你试一下.
错误1:nex---new
2,d; --d:
3,System.out.println....首字母大写

import java.io.*;

class Mainclass
{
public static void throwexception()throws Exception
{
Exception ee;
ee=new Exception("This is a sample of Exception");
throw ee;
}
public static void main(String args[])throws Throwable
{
FileOutputStream FileIn=new FileOutputStream("d:\\exception.txt");
PrintStream pp=new PrintStream(FileIn);
try
{
throwexception();
}
catch(Exception e)
{
System.out.println(e);
System.out.println(e.toString());
System.out.println(e.getMessage());
e.printStackTrace();
e.printStackTrace(pp);
throw e.fillInStackTrace();
}
}
}

d;\\exception.txt
d后边你打的是分号还是冒号呀,应该是分号才对