- Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy paththis.java
More file actions
Latest commit
21 lines (18 loc) · 415 Bytes
/
Copy paththis.java
File metadata and controls
21 lines (18 loc) · 415 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
classPerson {
privateStringname;
privateintage;
publicPerson(Stringname, intage) {
this.name = name;
this.age = age;
}
publicvoidprintDetails() {
System.out.println("Name: " + this.name);
System.out.println("Age: " + this.age);
}
}
publicclassthis{
publicstaticvoidmain(String[] args) {
Personperson1 = newPerson("Alice", 30);
person1.printDetails();
}
}