Skip to main content
Code Review

Return to Answer

Commonmark migration
Source Link

In addition to Alexei's feedback:

Use the Java API

###Use the Java API You'reYou're using Math.random() and casting to integer, If you use the internal API's Random object you can forego casting by invoking Random.nextInt() which has an overload method that you can employ to retrieve a number between 1-100 by using: Random.nextInt(100) + 1;

Notes on convention

###Notes on convention MethodsMethods in Java are usually written in camelCase, so your Start() method should simply be start() and StartGuess() would be startGuess(). This may seem of little consequence to you now, but code is the means you communicate to other programmers so following conventions matter for review, posterity and the processors which style code for readability.

Don't throw absent Exceptions

###Don't throw absent Exceptions You'veYou've imported and are throwing IOException when, unless I missed something, there aren't any IO operations going on whatsoever. Get rid of them.

In addition to Alexei's feedback:

###Use the Java API You're using Math.random() and casting to integer, If you use the internal API's Random object you can forego casting by invoking Random.nextInt() which has an overload method that you can employ to retrieve a number between 1-100 by using: Random.nextInt(100) + 1;

###Notes on convention Methods in Java are usually written in camelCase, so your Start() method should simply be start() and StartGuess() would be startGuess(). This may seem of little consequence to you now, but code is the means you communicate to other programmers so following conventions matter for review, posterity and the processors which style code for readability.

###Don't throw absent Exceptions You've imported and are throwing IOException when, unless I missed something, there aren't any IO operations going on whatsoever. Get rid of them.

In addition to Alexei's feedback:

Use the Java API

You're using Math.random() and casting to integer, If you use the internal API's Random object you can forego casting by invoking Random.nextInt() which has an overload method that you can employ to retrieve a number between 1-100 by using: Random.nextInt(100) + 1;

Notes on convention

Methods in Java are usually written in camelCase, so your Start() method should simply be start() and StartGuess() would be startGuess(). This may seem of little consequence to you now, but code is the means you communicate to other programmers so following conventions matter for review, posterity and the processors which style code for readability.

Don't throw absent Exceptions

You've imported and are throwing IOException when, unless I missed something, there aren't any IO operations going on whatsoever. Get rid of them.

Source Link
Legato
  • 9.9k
  • 4
  • 50
  • 118

In addition to Alexei's feedback:

###Use the Java API You're using Math.random() and casting to integer, If you use the internal API's Random object you can forego casting by invoking Random.nextInt() which has an overload method that you can employ to retrieve a number between 1-100 by using: Random.nextInt(100) + 1;

###Notes on convention Methods in Java are usually written in camelCase, so your Start() method should simply be start() and StartGuess() would be startGuess(). This may seem of little consequence to you now, but code is the means you communicate to other programmers so following conventions matter for review, posterity and the processors which style code for readability.

###Don't throw absent Exceptions You've imported and are throwing IOException when, unless I missed something, there aren't any IO operations going on whatsoever. Get rid of them.

lang-java

AltStyle によって変換されたページ (->オリジナル) /