import java.io.FileInputStream;
import java.io.FileOutputStream;
public class Student {
public static void main(String[] args) {
System.out.println("-------Writing Data in File-------");
try {
FileOutputStream fout = new FileOutputStream("stdinfo.txt");
String str = "Nmae : Sachin, Stream : Computer Engineering, Sem : 5th Sem";
byte b[] = str.getBytes();
fout.write(b);
fout.close();
System.out.println("successful write.");
} catch (Exception e) {
System.out.println(e);
}
System.out.println("-------Retrive Data From File-------");
try {
FileInputStream fin = new FileInputStream("stdinfo.txt");
int i = 0;
while ((i = fin.read()) != -1) {
System.out.print((char) i);
}
fin.close();
} catch (Exception e) {
System.out.println(e);
}
}
}
Wednesday, 12 August 2015
Create a class called Student. Write a student manager program to manipulate the student information from files by using FileInputStream and FileOutputStream
Labels:
Java
Subscribe to:
Post Comments (Atom)
thanx a lot ...
ReplyDeleteit working fully
Thank you man !
ReplyDeleteTHnx bro. Appreciate it.
ReplyDeletename spell is wrong
ReplyDeletei think it will look more good if you put screenshot of output :-)
ReplyDeleteGreat
ReplyDelete