-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStudentApp.java
More file actions
31 lines (30 loc) · 870 Bytes
/
StudentApp.java
File metadata and controls
31 lines (30 loc) · 870 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
28
29
30
31
package com.sarvesh.javabasics;
public class StudentApp {
static class Student {
String name;
int age;
double marks;
Student(String name, int age, double marks) {
this.name = name;
this.age = age;
this.marks = marks;
}
void displayDetails() {
System.out.println("Name: " + name);
System.out.println("Age: " + age);
System.out.println("Marks: " + marks);
}
void isPassed() {
if (marks >= 40) {
System.out.println("Result: Passed");
} else {
System.out.println("Result: Failed");
}
}
}
public static void main(String[] args) {
Student s1 = new Student("Sarvesh", 20, 75);
s1.displayDetails();
s1.isPassed();
}
}