0% found this document useful (0 votes)
3 views4 pages

Java File Handling Mini Project

The document outlines a mini project titled 'Student Record Management System' that demonstrates file handling in Core Java. It allows users to create, save, view, and search student records using a text file for data persistence, while incorporating exception handling and basic programming concepts. The guide includes project objectives, tools, program logic, sample code, and expected learning outcomes.

Uploaded by

dineshmemory001
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views4 pages

Java File Handling Mini Project

The document outlines a mini project titled 'Student Record Management System' that demonstrates file handling in Core Java. It allows users to create, save, view, and search student records using a text file for data persistence, while incorporating exception handling and basic programming concepts. The guide includes project objectives, tools, program logic, sample code, and expected learning outcomes.

Uploaded by

dineshmemory001
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Java File Handling – Mini Project Guide

Project Title: Student Record Management System

This mini project demonstrates how file handling works in Core Java using a real-world example. The
program allows users to store, view, and search student records using a text file for data persistence.

Project Objectives
1 Create student records

2 Save records into file

3 Read records from file

4 Search student by ID

5 Use exception handling

6 Apply loops and conditions

Tools & Technologies


1 Language: Java
2 Concepts: File Handling, Loops, OOP Basics
3 IDE: Any (Eclipse / IntelliJ / VS Code)

Program Logic
1 User selects option from menu

2 Program asks student details

3 Details are saved in file

4 User can display all records

5 User can search record by ID

Java Program Code


import [Link].*;
import [Link].*;

class Student {
int id;
String name;
int marks;

Student(int id, String name, int marks){


[Link] = id;
[Link] = name;
[Link] = marks;
}
}

public class StudentFileProject {

static final String FILE = "[Link]";

public static void addStudent() throws Exception {


Scanner sc = new Scanner([Link]);
FileWriter fw = new FileWriter(FILE, true);

[Link]("Enter ID: ");


int id = [Link]();
[Link]();

[Link]("Enter Name: ");


String name = [Link]();

[Link]("Enter Marks: ");


int marks = [Link]();

[Link](id + "," + name + "," + marks + "\n");


[Link]();

[Link]("Student Saved Successfully");


}

public static void viewStudents() throws Exception {


BufferedReader br = new BufferedReader(new FileReader(FILE));
String line;

while((line = [Link]()) != null){


String data[] = [Link](",");
[Link]("ID: " + data[0] +
" Name: " + data[1] +
" Marks: " + data[2]);
}
[Link]();
}

public static void searchStudent() throws Exception {


Scanner sc = new Scanner([Link]);
[Link]("Enter ID to search: ");
String searchId = [Link]();

BufferedReader br = new BufferedReader(new FileReader(FILE));


String line;
boolean found = false;

while((line = [Link]()) != null){


String data[] = [Link](",");
if(data[0].equals(searchId)){
[Link]("Record Found -> Name: " + data[1] +
" Marks: " + data[2]);
found = true;
break;
}
}

if(!found)
[Link]("Student not found");

[Link]();
}

public static void main(String[] args) throws Exception {


Scanner sc = new Scanner([Link]);

while(true){
[Link]("\[Link] Student");
[Link]("[Link] Students");
[Link]("[Link] Student");
[Link]("[Link]");
[Link]("Choose: ");
int ch = [Link]();

switch(ch){
case 1: addStudent(); break;
case 2: viewStudents(); break;
case 3: searchStudent(); break;
case 4: [Link](0);
default: [Link]("Invalid Choice");
}
}
}
}
Sample Output
[Link] Student
[Link] Students
[Link] Student
[Link]
Choose: 1
Enter ID: 101
Enter Name: Dinesh
Enter Marks: 89
Student Saved Successfully

Choose: 2
ID: 101 Name: Dinesh Marks: 89

Learning Outcomes
1 Understand real-world file storage

2 Learn reading and writing files

3 Implement search logic

4 Practice structured programming

5 Gain interview-ready project knowledge

You might also like