This code defines a checkAge method that takes an integer parameter called age. The method prints "Access denied" if age is less than 18, and "Access granted" if age is greater than or equal to 18. The main method calls checkAge, passing in the value 20.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
73 views
Exercises Java
This code defines a checkAge method that takes an integer parameter called age. The method prints "Access denied" if age is less than 18, and "Access granted" if age is greater than or equal to 18. The main method calls checkAge, passing in the value 20.