//程序总是打印if语句中写的行。//另外,每次我尝试添加else语句时,eclipse都会返回错误
import java.util.Scanner;
import java.util.Arrays;
public class Practice {
public static void main(String[] args)
Scanner input = new Scanner(System.in);
System.out.println("Enter the number of artists you would like to search: ");
int number = input.nextInt();
String junk = input.nextLine();
String []artist = new String[number];
for(int i=0; i < number ; i++)
{
artist[i]= input.nextLine();
}
System.out.println("Here is the list of artists you searched for: " + Arrays.toString(artist) + ". Is this correct?");
String check = input.nextLine();
if((check.equalsIgnoreCase("yes") || check.equalsIgnoreCase("y")) == false); //this continually returns both print statements in and out of the if statement even if I input something other than yes or y and I have no idea why
{
System.out.println("Cool! Enjoy your search!"); //this always prints no matter what
}
System.out.println("Please try again! Sorry for the inconvenience!"); //won't let me add an else statement