jeudi 29 avril 2021

I cant make a random number turn in a string [closed]

Random random = new Random();
int monster = random.nextInt(3);
    
}if (String.valueOf(monster).equals(3)) 
 System.out.println("Um dragão enorme aparceu!");

}if (String.valueOf(monster).equals(2));
System.out.println("Um lobo selvagem apareceu!"); 
    
}if (String.valueOf(monster).equals(1));
System.out.println("UM velho aparceu!"); 
    }
}

Multiple markers at this line - Syntax error on token "}", { expected - Unlikely argument type for equals(): int seems to be unrelated to String

Multiple markers at this line - monster cannot be resolved to a variable - Unlikely argument type for equals(): int seems to be unrelated




Aucun commentaire:

Enregistrer un commentaire