📄 filedemo14.java
字号:
/**
*This program write a single character to the file system and then
* read it back and print it to the console.
*Compile two programs seperately!
*2005.1.1. xhcprince:)
*/
/*----------------------------------------------------------------------------------
The DataInputStream and DataOutputStream are used to read binary representations
of java primitives in a portable way.It gives yo access to a range of methods
such as readInt(),readDouble(),etc (however, there's not a writeLine() method,so
I don't know how to input a String) that will work the same
on different platforms
*---------------------------------------------------------------------------------*/
//write the file//
import java.io.*;
public class fileDemo14
{
public static void main(String args[]) throws IOException
{
FileOutputStream fout = new FileOutputStream("c.doc");
DataOutputStream dout = new DataOutputStream(fout);
dout.writeChar('j');
}
}
//read the file//
/*
import java.io.*;
public class fileDemo14
{
public static void main(String args[]) throws IOException
{
FileInputStream fin = new FileInputStream("fout.dat");
DataInputStream din = new DataInputStream(fin);
System.out.println(din.readChar());
}
}
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -