⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 filedemo14.java

📁 JAVA程序设计课程中各章节的程序实例。
💻 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("fout.dat");
		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 + -