Add OOP/Java/Lab/Week7/MIT.java
This commit is contained in:
parent
2a97c1f104
commit
3c665489ed
28
OOP/Java/Lab/Week7/MIT.java
Normal file
28
OOP/Java/Lab/Week7/MIT.java
Normal 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();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user