임의의 0부터 100까지의 정수 출력 (자바)
조회수 1140회
System.out.println(Math.random()*100 + 1);
System.out.println((int)Math.random() * 101);
System.out.println((int)Math.random() * 100);
System.out.println((int)Math.random() * 100 + 1);
이 문제에서 어떤 명령어가 먼저 시행되는건가요? 0.0<=x<1까지의 난수 출력 후, 뒤의 연산을 시행하나요? 답은 2번째 문항이라는데 이해가 잘 가지 않아 질문 드립니다!
댓글 입력