-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStudent.java
More file actions
27 lines (22 loc) · 728 Bytes
/
Student.java
File metadata and controls
27 lines (22 loc) · 728 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
public class Student {
private int id;
private String name;
private double marks;
// Constructor
public Student(int id, String name, double marks) {
this.id = id;
this.name = name;
this.marks = marks;
}
// Getters and Setters
public int getId() { return id; }
public void setId(int id) { this.id = id; }
public String getName() { return name; }
public void setName(String name) { this.name = name; }
public double getMarks() { return marks; }
public void setMarks(double marks) { this.marks = marks; }
// Display student info
public void display() {
System.out.printf("ID: %d | Name: %s | Marks: %.2f%n", id, name, marks);
}
}