내 코드에 도움이 필요합니다. 나는 자바의 멍청한 놈이지만 언젠가는 그 일에 정말로 잘할 수 있기를 희망한다. 내가 다른 비판하고 나는 그것이 알고 있기 때문에 이것은 nooby 작은 게임이라고하지 마십시오이?내 경우 엔 Else statement ... Im noob
if (random == r);
System.out.println("You Win! You get: $" + m);
if (random != r);
System.out.println("You lose :(Try again?");
사이에 로그인 할 것 어떻게
static Scanner sc = new Scanner(System.in);
public static void main(String[] args){
Lottery();
}
public static void Lottery(){
System.out.println("Welcome to Jacks Lottery!");
System.out.println("If the Numbers match... You Win! It will pick a random number of the money you win!");
int random = (int)(Math.random() * 50 + 1);
int r = (int)(Math.random() * 50 + 1);
int m = (int)(Math.random() * 1000 + 1);
System.out.println("The First Number is: " + random);
System.out.println("The Second Number is: " + r);
if (random == r);
System.out.println("You Win! You get: $" + m);
if (random != r);
System.out.println("You lose :(Try again?");
}
}
. 나는 가족을 보여주고 그들을 깜짝 놀라게하는 재미있는 일을하고 있습니다. if
if (random == r);
;
에서 세미콜론
을 변경할 수 있습니다 {'제어 흐름 문과 함께. 그것은 당신이 그것을 알지 못하는 사이에 당신의 목숨을 구할 것입니다. – Shail016