简述File类的应用,它与RandomAccessFile类有何区别。
简述File类的应用,它与RandomAccessFile类有何区别。
相关考题:
下面哪个方法在RandomAccessFile类有,而在Reader或Writer类中没有()A、voidclose()B、intread()C、setLength(longnewLength)D、以上都不是
下面关于java中输入/输出流的说法正确的是()。A.FileInputStream与FileOutputStream类用读、写字节流B.Reader与Writer类用来读、写字符流C.RandomAccessFile既可以用来读文件,也可以用来写文件D.File类用来处理与文件相关的操作
以下创建RandomAccessFile类实例对象的代码,哪些是正确的( )。 A、RandomAccessFile(newFile("D:\\itcast\\dir1\\test.java"),"rw")B、RandomAccessFile("D:\\itcast\\dir1\\test.java","r")C、RandomAccessFile("D:\\itcast\\dir1\\test.java")D、RandomAccessFile("D:\\itcast\\dir1\\test.java","wr")
正确生成RandomAccessFile对象的语句的是A.File f=new File("readFile"); RandomAccessFile raF=new RandomAccessFile(f);B.RandomAccessFile raF=new RandomAccessFile(d:\\mydir\\File3.txt,"rw");C.RandomAccessFile raF=new RandomAccessFile("readwriteFile","rw");D.RandomAccessFile raF=new RandomAccessFile("readwriteFile",rw);
正确生成RandomAccessFile对象的语句是 ( )A.File f=new File("readFile");B.RandomAccessFile raF=new RandomAcccssFile(d:\mydir\File3.txt,"rw");C.RandomAccessFile raF=new RandomAccessFile("readwriteFile","rw");D.RandomAccessFile raF=new RandomAccessFite("readwriteFile",rw)
在下列程序的横线处填入正确的语句,实现RandomAccessFile类使用。 package ch1; import java. io. *; public class ex27 { public static void main(String args[] ) { try { RandomAccessFile in = new in.close ( ); } catch (Exception e) { e.printStackTrace (); } } }A.RandomAccessFileC"ch1/file.dat", "read")B.RandomAccessFile("r", "ch1/file.dat")C.RandomAccessFile("ch1/file.dat" , "r")D.RandomAecessFile("read", "ch1/file.dat")
下面的说法正确的是()A、InputStream与OutputStream都是抽象类B、Reader与Writer不是抽象类C、RandomAccessFile是抽象类D、File类是抽象类
要从文件" file.dat"文件中读出第10个字节到变量C中,下列哪个方法适合? ()A、 FileInputStream in=new FileInputStream("file.dat"); in.skip(9); int c=in.read();B、 FileInputStream in=new FileInputStream("file.dat"); in.skip(10); int c=in.read();C、 FileInputStream in=new FileInputStream("file.dat"); int c=in.read();D、 RandomAccessFile in=new RandomAccessFile("file.dat"); in.skip(9); int c=in.readByte();
以下哪些是合法的构造RandomAccessFile对象的代码()。A、RandomAccessFile(new File("D:////myex//dir1//..//test.java"),"rw")B、RandomAccessFile("D:////myex//test.java","r")C、RandomAccessFile("D:////myex//test.java")D、RandomAccessFile("D:////myex//test.java","wr")
要从文件"file.dat"中读出第10个字节到变量c中,下列哪个方法适合?()A、FileInputStream in=new FileInputStream("file.dat");in.skip(9);intc=in.read()B、FileInputStream in=new FileInputStream("file.dat");in.skip(10);intc=in.read()C、FileInputStream in=new FileInputStream("file.dat");intc=in.read()D、RandomAccessFile in=new RandomAccessFile("file.dat");in.skip(9);intc=in.readByte()
单选题RandomAccessFile类的()方法可用于从指定流上读取字符串。AreadIntBreadLIneCseekDclose