import java.io.*;public class Hello
{
public static void main(String[] args)
{
try
{
FileOutputStream fos = new FileOutputStream("hello.txt");
String str = "hello";
fos.write(str.getBytes());
fos.close();
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
{
public static void main(String[] args)
{
try
{
FileOutputStream fos = new FileOutputStream("hello.txt");
String str = "hello";
fos.write(str.getBytes());
fos.close();
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
{
public static void main(String[] args)
{
try
{
//从键盘读入...
byte[] buf = new byte[1024];
FileOutputStream fos = new FileOutputStream("hello.txt");
int l = System.in.read(buf);
String str = new String(buf,0,l);
fos.write(str.getBytes());
fos.close();
//从文本输出...
FileInputStream fis = new FileInputStream("hello.txt");
int len = fis.read(buf);
String sss = new String(buf,0,len);
System.out.println(sss);
fis.close();
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
{
public static void main(String[] args)
{
try{
System.setOut(new PrintStream("d:\data.txt"));
}
catch(Exception e)
{
}
Integer i = new Integer(42);
Long l = new Long(42);
Double d = new Double(42.0);
if(i==1)
{
System.out.println("true");
}
else
{
System.out.println("false");
}
if(1==d)
{
System.out.println("true");
}
else
{
System.out.println("false");
}
if(l==1)
{
System.out.println("true");
}
else
{
System.out.println("false");
}
System.out.println(i.equals(l));
System.out.println(i.equals(d));
System.out.println(l.equals(d));
System.out.println(i.equals(42));
}
}