PRO192_-_SU_2023_-_Block_5_-_2_754.webp
Minh Đức1

PRO192_-_SU_2023_-_Block_5_-_2_754.webp

(Choose 1 answer)
Finish
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());}
El 30

Thông tin

Category
PRO192
Thêm bởi
Minh Đức1
Ngày thêm
Lượt xem
2,756
Lượt bình luận
19
Rating
0.00 star(s) 0 đánh giá

Image metadata

Filename
PRO192_-_SU_2023_-_Block_5_-_2_754.webp
File size
47.4 KB
Dimensions
1286px x 546px

Share this media

Back
Bên trên Bottom