0% found this document useful (0 votes)
6 views2 pages

Java Program for Student Attendance Log

The Java program allows users to input student roll numbers, days, and times, which are then written to a file named 'file.txt'. It uses a loop to continuously prompt for input until the user decides to exit. Error handling is included to manage potential IO exceptions during file operations.

Uploaded by

A.M Tanush
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)
6 views2 pages

Java Program for Student Attendance Log

The Java program allows users to input student roll numbers, days, and times, which are then written to a file named 'file.txt'. It uses a loop to continuously prompt for input until the user decides to exit. Error handling is included to manage potential IO exceptions during file operations.

Uploaded by

A.M Tanush
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

Program 1:

import [Link];

import [Link];
import [Link];

public class Student {

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


Scanner sc = new Scanner([Link]);

try {

FileWriter writer = new FileWriter("[Link]", true);


int choice = 1;

while (choice == 1) {

[Link]("Enter the Student Roll no (Ex 901) : ");

String roll = [Link]();

[Link]("Enter the Day : ");

String day = [Link]();

[Link]("Format of Time Ex :- 02:11 . Please enter 0 in front of single


digit time.");

[Link]("Enter the Time : ");


String time = [Link]();

String all = day + roll + time ;

[Link](all);

[Link]("If you want to add next student enter (1) or (0) to exit : ");
choice = [Link]();
[Link]();

[Link]();

} catch (IOException e) {
[Link]("An error occurred.");

[Link]();
}

}
}

You might also like