- import java.io.Console;
- public class Ch09
- {
- public static void main(String args[])
- {
- Console c=System.console();
- int age;
- System.out.print("Enter your age: ");
- age=Integer.parseInt(c.readLine());
- if (age>=18)
- System.out.println("You can test for your driver's liscence!");
- else
- System.out.println("You are under 18, wait a few years!");
- }
- }
複製代碼 |