Java's IO simple application

xiaoxiao2021-03-06  47

Java's IO system is relatively large and complicated. The general novice is also very clear about it. I have made a few simple examples I hope to have some help to everyone. / / Read data from the file, displayed on the screen;

Import java.io. *;

Public class think {public static void main (string [] args) {Try {fileinputstream file = new fileinputstream ("d: //ss.txt"); char [] c = new char [file.available ()]; for (INT i = 0; i

Import java.io. *; import java.util. *;

Public class think {public static void main (string [] args) {try {byte [] c = new byte [1000]; system.in.read (c); fileoutputstream file = new fileoutputstream ("D: // s. TXT "); file.write (c);} catch (exception e) {E.PrintStackTrace ();}}} // Copy from a file to another file package;

Import java.io. *; import java.util. *;

public class Think {public static void main (String [] args) {try {FileInputStream file = new FileInputStream ( "d: //sss.txt"); FileOutputStream fileout = new FileOutputStream ( "d: //aaa.txt") BYTE [] c = new byte [file.available ()]; for (int i = 0; i

Import java.io. *; import java.util. *;

转载请注明原文地址:https://www.9cbs.com/read-79973.html

New Post(0)