This Java code defines a method called checkAge that takes an integer age as a parameter. It prints "Access denied" if age is less than 18, and "Access granted" if age is greater than or equal to 18. The main method prompts the user to input an age, passes it to checkAge, and prints the resulting message.
This Java code defines a method called checkAge that takes an integer age as a parameter. It prints "Access denied" if age is less than 18, and "Access granted" if age is greater than or equal to 18. The main method prompts the user to input an age, passes it to checkAge, and prints the resulting message.
This Java code defines a method called checkAge that takes an integer age as a parameter. It prints "Access denied" if age is less than 18, and "Access granted" if age is greater than or equal to 18. The main method prompts the user to input an age, passes it to checkAge, and prints the resulting message.