正在加载图片...
File objects r To operate on a file, we must first create a File object from java. io) Opens the file sample. dat File inFile new File(sample. dat")i in the current directory Opens the file one. txt in File inFile the directory new File(C: \\SamplePrograms C: ISample Programs one. txti Notice the use of the escape character \ Opens the file test. dat in File infile new File the directory (C:/SamplePrograms/test. dat")i C: \Sample Programs using the generic file separator/and providing the full pathname C 2000 McGraw-Hill Introduction to Object-Oriented Programming with Java--Wu Chapter 11-3© 2000 McGraw-Hill Introduction to Object-Oriented Programming with Java--Wu Chapter 11 - 3 File Objects To operate on a file, we must first create a File object (from java.io). File inFile = new File(“sample.dat”); File inFile = new File(“C:\\SamplePrograms”, “one.txt”); File inFile = new File (“C:/SamplePrograms/test.dat”); Opens the file sample.dat in the current directory. Opens the file one.txt in the directory C:\SamplePrograms. Notice the use of the escape character \. Opens the file test.dat in the directory C:\SamplePrograms using the generic file separator / and providing the full pathname
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有