PRO192_-_SP_2024_-_Block_5_-_RE_1965.webp
T

PRO192_-_SP_2024_-_Block_5_-_RE_1965.webp

}
class Professor extends Person {
(Choose 1 answer)
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;
}
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);
}
}
A. Huong:40
Binh:0
D Uuong-0

Thông tin

Category
PRO192
Thêm bởi
thanhhoa88
Ngày thêm
Lượt xem
5,284
Lượt bình luận
13
Rating
0.00 star(s) 0 đánh giá

Image metadata

Filename
PRO192_-_SP_2024_-_Block_5_-_RE_1965.webp
File size
244.5 KB
Dimensions
1920px x 1012px

Share this media

Back
Bên trên Bottom