/***@(#)Test.java***@author*@version1.002007/9/22*/importjava.io.*;publicclassTest{publicTest(){}publicstaticvoidmain(String[]args){Filef=newFile("C:\\j2sdk1.4.2\\t","dat...
/**
* @(#)Test.java
*
*
* @author
* @version 1.00 2007/9/22
*/
import java.io.*;
public class Test {
public Test()
{
}
public static void main (String[] args)
{
File f=new File("C:\\j2sdk1.4.2\\t","data.txt");
Wir w=new Wir();
w.writ(f);
}
}
class Wir
{
String name="in it";
int age=18;
boolean sex=true;
public void writ(File f)
{
try
{
FileOutputStream outs=new FileOutputStream(f);
DataOutputStream dat=new DataOutputStream(outs);
/*try
{
dat.writeBytes(name);
dat.writeInt(age);
dat.writeBoolean(sex);
}
catch(IOException e)
{
}*/
}
catch(FileNotFoundException e)
{
}
try
{
dat.writeBytes(name);
dat.writeInt(age);
dat.writeBoolean(sex);
}
catch(IOException e)
{
}
}
}
编译结果:
cannot resolve symbol variable dat
cannot resolve symbol variable dat
cannot resolve symbol variable dat
局部变量--这我也知道,我需要详细点,异常的在编译过程中有没有什么特殊的,
展开