java check age | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

java check age

Write a method called checkAge that takes in an int representing the year someone was born, and another Int representing the current year. The method should return an Int that is the person's (rough) current age age. Then overload that method with one that accepts a single int as the year someone was born and gives the current year argument a default value of 2018.

3rd Apr 2019, 5:21 PM
Albert Yakubov
Albert Yakubov - avatar
1 Answer
+ 2
class1 int checkAge( bornYear, currentYear ) return expression int checkAge( bornYear ) return call first method add class / method syntax, type for parameters, expressions, main() +test result
3rd Apr 2019, 7:41 PM
zemiak