PRO192_-_SP_2024_-_FE_1629.webp
N

PRO192_-_SP_2024_-_FE_1629.webp

Answer (Choose 1 answer)
What will be the output of following code?
class Employee{private String dob;
public Employee(String dob) {
this.dob = dob;
}
public int getAge(){
String t=dob.split("/");int m=Integer.parseInt(t[1]);
int y=Integer.parseInt(t[2]);
if(m<6)
return (2021-y);
else
return (2021-y+1);
}
}
public class Main{
public static void main(String[] args) {
} System.out.println(new Employee("11/06/2000").getAge());
}
A. 21
B. 22
C. 19
D. 20


Exit (20

Thông tin

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

Image metadata

Filename
PRO192_-_SP_2024_-_FE_1629.webp
File size
68.3 KB
Dimensions
1926px x 906px

Share this media

Back
Bên trên Bottom