I am very new and young and i can not see what the error is. I am trying to use the Scanner to hold a String for how how and if how =yes execute the yes case and if no execute the no case this is all inside the else statement from the first question
package test;
import java.util.Scanner;
public class Try {
public static void main(String[] args) {
System.out.println("hello world");
Scanner input = new Scanner(System.in);
System.out.println("Do you wanna make android apps");
System.out.println("Yes or no ?");
String copy=input.nextLine();
System.out.println(copy);
if(copy.equals("yes")){
System.out.println("you should continue java");
}else{
System.out.println("Do you wanna make iso apps");
System.out.println("yes or no");
String how = null;
switch(how.toLowerCase()){
case "yes" :System.out.println("test worked");
break;
case "no":System.out.println("test worked 2");
break;
}
}
}}
Aucun commentaire:
Enregistrer un commentaire