neelam
java RandomAccessFile
1 Answer(s)      4 years and 8 months ago
Posted in : Java Interview Questions
What is the difference between the File and RandomAccessFile classes?
Advertisement
View Answers

October 18, 2010 at 12:43 PM


The java.io.File class is used to perform the operations on files and directories of the file system of an operating system. This operating system is the platform for the java application that uses the File class objects. The contents of the files cannot be read or write. The java.io.RandomAccessFile class has methods that perform the direct access to data of any part of the file. RandomAccessFile class also provides the facilities to read and write data from a single file without closing the streams for each read or write. It provides the facilities to write primitive data to the files.









Related Tutorials/Questions & Answers:
java RandomAccessFile
java RandomAccessFile  What is the difference between the File and RandomAccessFile classes
RandomAccessFile & FileInputStream - Java Beginners
RandomAccessFile & FileInputStream  I included a piece of code for reading data from a file using FileInputStream and RandomAccessFile class: RandomAccessFile class ------------------------------- File f = new File
Advertisements
Java RandomAccessFile Example
Java RandomAccessFile Example Here you will learn about the RandomAccessFile... between 2 and 10 into text file. Then using the RandomAccessFile, we have...(); } } bw.close(); RandomAccessFile randomFile=new RandomAccessFile(f,"rw"
Java I\O file
Java I\O file  What is the difference between the File and RandomAccessFile classes
java io
java io  Write a program to use a File object and print even numbers from two to ten. Then using RandomAccessFile write numbers from 1 to 5. Then using seek () print only the last 3 digits
How to use random access file
of RandomAccessFile class. RandomAccessFile allows read and write operations to any... manner. Unlike other  input and output streams, RandomAccessFile.... If you want to perform read operation with RandomAccessFile, then you have
java help - Java Beginners
java help  Write the code for a method named getFile that accepts a file name and returns a file created from the RandomAccessFile class. This method should catch the FileNotFoundException if it occurs and print the message ?File
java - Java Beginners
java  public static void Trial(File file) { RandomAccessFile input = null; whats wrong in it? String line = null; try { input = new RandomAccessFile(file, "r"); while ((line
Java programming help with files - Java Beginners
Java programming help with files  I want a code or the following...")){ RandomAccessFile rand = new RandomAccessFile("American.txt","rw"); rand.writeBytes(data); rand.close(); } else{ RandomAccessFile rand = new
Java prob - Java Beginners
Java prob  Hello please help me with the following program.So... createRandomFile_sheet11 { private RandomAccessFile output; private static final... RandomAccessFile("sheet11.ser","rw"); } public void closeFile()throws Exception
Java MappedByteBuffer example, How to create a large size file in java.
Java MappedByteBuffer example, How to create a large file in java... of MappedByteBuffer class in java. Code import java.io.RandomAccessFile; import ...;RandomAccessFile out = new RandomAccessFile("test.txt", 
Core Java Interview Question, Interview Question
Core Java Interview Question Page 21  .... Question: What is the difference between the File and RandomAccessFile classes... system. The RandomAccessFile class provides the methods needed to directly access
Java file seek
Java file seek This section illustrates you the use of seek() method... is RandomAccessFile. This class has two arguments, one of which is a File object... created an object of RandomAccessFile class and pass file object and 'rw' mode
IOException - Java Beginners
("DemoRandomAccessFile.out"); RandomAccessFile raf = new RandomAccessFile(file, "rw...("DemoRandomAccessFile.out"); RandomAccessFile raf = new RandomAccessFile(file, "rw"); raf.seek
Using a Random Access File in Java
C:\nisha>javac RandAccessFile.java C:\nisha>java...;= new RandomAccessFile(file,"r");    int i=(int...: C:\nisha>java ReadAccessFile Enter File name : Filterfile.txt
File Handling - Java Beginners
{ File f; f= new File(name); if(f.exists()){ RandomAccessFile rand = new RandomAccessFile(name,"rw"); System.out.println
java
java  diff bt core java and java
java
java  what is java
Java
Java   Whether Java is pure object oriented Language
java
java  different between java & core java
java
java  explain technologies are used in java now days and structure java
java
java   why iterator in java if we for loop
JAVA
JAVA  how the name came for java language as "JAVA
java
java  what is java reflection
java
java  is java open source
java
what is the size of array in java ?  what is the size of array in java ? what is the mean of finalize in java
java
java   in java does not pointers concept but what is nullpointers in java?   nullpointer is a runtime Exception
File Handling In Java
File Handling in Java In this section we will discuss about the file handling in Java. This section describes you about how to perform file handling in Java. In this section you will read what is file handling in Java, how to perform
java
java  write a java program using filenotfoundexception
java
java   difference between class and interface
java
java  why multiple inheritance is not possible in java