Posted on 2006-11-12 23:21
苑 阅读(584)
评论(0) 编辑 收藏 所属分类:
java基础学习系列
import
java.io.DataOutputStream;
import
java.io.FileOutputStream;
public class
MainClass
{
public static
void
main
(
String args
[]) {
try
{
FileOutputStream fos =
new
FileOutputStream
("fileName"
)
;
DataOutputStream dos =
new
DataOutputStream
(
fos
)
;
dos.writeBoolean
(
false
)
;
dos.writeByte
(
Byte.MAX_VALUE
)
;
dos.writeChar
(
'A'
)
;
dos.writeDouble
(
Double.MAX_VALUE
)
;
dos.writeFloat
(
Float.MAX_VALUE
)
;
dos.writeInt
(
Integer.MAX_VALUE
)
;
dos.writeLong
(
Long.MAX_VALUE
)
;
dos.writeShort
(
Short.MAX_VALUE
)
;
fos.close
()
;
}
catch
(
Exception e
) {
System.out.println
(
"Exception: "
+ e
)
;
}
}
}