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();
    }
}

Comments

Popular posts from this blog

5th sem OOPJ Write an interactive program to print a diamond shape. For example, if user enters the number 3, the diamond will be as follows:

SQL Lab1: Create a Database Table for DayCare

SQL Lab 11