我正在尝试制作一个随机生成的数组字,我没有发现这段代码有任何问题,但它只是没有运行,当有一个随机生成的数字时,它不会向我显示数组的字。我的代码有什么问题?
import java.util.Scanner;
import java.util.Random;
public class apples{
public static void main(String[] args){
Random dice = new Random();
Scanner scan = new Scanner(System.in);
String me[] = new String[5];
me[0] = "Wow";
me[1] = "LoL";
me[2] = "Jis, Ji";
me[3] = "Mes";
me[4] = "Jus";
System.out.println("Enter YES or NO: ");
String roll = scan.nextLine();
String name = "yes";
if(roll == name){
int result = dice.nextInt(5);
if(result == 0){
System.out.println(me[0]);
}else if(result == 1){
System.out.println(me[1]);
}else if(result == 2){
System.out.println(me[2]);
}else if(result == 3){
System.out.println(me[3]);
}else if(result == 4){
System.out.println(me[4]);
}
}else{
System.out.println("Bad");
}
}
}