Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package drivingage;
- public class DrivingAge {
- public static void main(String[] args) {
- }
- public static void forLoop(String light){
- for(int age = 1;age<=99;age+=20){
- System.out.println(age);
- }
- int age = 16;
- }
- public static void ifElse(String age){
- if (age.equals(16)){
- System.out.println("Reached minimum age limit.");
- }else{
- System.out.println("Must wait until you reach the minimum age!");
- }
- }
- public static void switchMethod(String light){
- DrivingAge age = new DrivingAge();
- switch (16){
- case 1:
- System.out.println("You can not get your drivers license!");
- break;
- case 16:
- System.out.println("You can get your drivers license!");
- break;
- case 21:
- System.out.println("You should have your license by now!);
- default:
- System.out.println("I don't know what message to put here.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement