Add OOP/Java/Lab/Week7/MIT.java

This commit is contained in:
Aadit Agrawal 2024-09-14 01:54:08 +05:30
parent 2a97c1f104
commit 3c665489ed

View File

@ -0,0 +1,28 @@
class MIT {
class Student_Detail {
String name;
int id;
String college_name;
Student_Detail(String name, int id) {
this.name = name;
this.id = id;
this.college_name = "MIT";
}
void display_details() {
System.out.println("Name: " + name);
System.out.println("ID: " + id);
System.out.println("College: " + college_name);
}
}
public static void main(String[] args) {
MIT mit = new MIT();
MIT.Student_Detail student =
mit.new Student_Detail("Sherlock Holmes", 230953344);
student.display_details();
}
}