PRO192_-_C2_-_FE_-_SU_2023_398.webp
T

PRO192_-_C2_-_FE_-_SU_2023_398.webp

Answer (Choose 1 answer)
}
Exit 35
What is the output of the following code?
class Person {
protected int age;
protected void setAge(int val) {
age = val;
}
protected int getAge() {
return age;
}
}
class Professor extends Person {
Professor(String val) { specialization = val;
} String specialization;
String getSpecialization() {
return specialization;
}
public class Main {
public static void main(String args[]) { Professor p1 = new Professor("Binh");
Professor p2 = new Professor("Huong");
p1.setAge(40);
System.out.println(p2.getSpecialization() + ":" + p1.age);
System.out.println(p1.getSpecialization() + ":" + p2.age);

Thông tin

Category
PRO192
Thêm bởi
Thái Dương1
Ngày thêm
Lượt xem
2,517
Lượt bình luận
7
Rating
0.00 star(s) 0 đánh giá

Image metadata

Filename
PRO192_-_C2_-_FE_-_SU_2023_398.webp
File size
59.3 KB
Dimensions
1542px x 690px

Share this media

Back
Bên trên Bottom