5th sem OOPJ Create a class called Student. Write a student manager program to manipulate the student information from files by using FileInputStream and FileOutputStream
import java.io.FileInputStream;
import java.io.FileOutputStream;
/**
*
* @author Yash
*/
public class pra11 {
public static void main(String arg[])throws Exception{
FileOutputStream fout = new FileOutputStream("new.txt"); //new.txt shold be on same directory of the java program file.
String s1 = "\n Student's name : Mr. abc\n Branch : Computer Engineering\n Sem : 5th\n Batch : H";
byte b[] = s1.getBytes();
fout.write(b);
FileInputStream fin = new FileInputStream("new.txt");
int i = 0;
while((i=fin.read()) != -1){
System.out.print((char)i);
}
fin.close();
}
}
import java.io.FileOutputStream;
/**
*
* @author Yash
*/
public class pra11 {
public static void main(String arg[])throws Exception{
FileOutputStream fout = new FileOutputStream("new.txt"); //new.txt shold be on same directory of the java program file.
String s1 = "\n Student's name : Mr. abc\n Branch : Computer Engineering\n Sem : 5th\n Batch : H";
byte b[] = s1.getBytes();
fout.write(b);
FileInputStream fin = new FileInputStream("new.txt");
int i = 0;
while((i=fin.read()) != -1){
System.out.print((char)i);
}
fin.close();
}
}
Comments
Post a Comment