求一段java小程序的注释 最好详细一些
/**GuesstheNumber**@authorguanzhi*@version1.11/1/10*/importjava.util.Random;publiccla...
/*
* Guess the Number
*
* @author guanzhi
* @version 1.1 1/1/10
*/
import java.util.Random;
public class GuessIt
{
public static void main(String[] args)
{
int computerNumber;
int yourGuess;
Random myRandom = new Random();
// get the computer's number between 1 and 10
computerNumber = myRandom.nextInt(10) + 1;
System.out.println("I'm thinking of a number between 1 and 10.");
// get your guess
yourGuess = Typeit.inInt("What do you think it is?");
//analyze guess and print results
if (yourGuess == computerNumber)
{
// you got it
System.out.println("You got it!! That’s my number!");
}
else if (yourGuess < computerNumber)
{
// too low
System.out.println("You are too low!! My number was " + computerNumber);
}
else
{
// too high
System.out.println("You are too high!! My number was " + computerNumber);
}
}
} 展开
* Guess the Number
*
* @author guanzhi
* @version 1.1 1/1/10
*/
import java.util.Random;
public class GuessIt
{
public static void main(String[] args)
{
int computerNumber;
int yourGuess;
Random myRandom = new Random();
// get the computer's number between 1 and 10
computerNumber = myRandom.nextInt(10) + 1;
System.out.println("I'm thinking of a number between 1 and 10.");
// get your guess
yourGuess = Typeit.inInt("What do you think it is?");
//analyze guess and print results
if (yourGuess == computerNumber)
{
// you got it
System.out.println("You got it!! That’s my number!");
}
else if (yourGuess < computerNumber)
{
// too low
System.out.println("You are too low!! My number was " + computerNumber);
}
else
{
// too high
System.out.println("You are too high!! My number was " + computerNumber);
}
}
} 展开
3个回答
展开全部
此程序这里能正常运行么?
yourGuess = Typeit.inInt("What do you think it is?");
求大神指教!另 键盘录入除了Scanner 还有其他类么?(io除外)
yourGuess = Typeit.inInt("What do you think it is?");
求大神指教!另 键盘录入除了Scanner 还有其他类么?(io除外)
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
你这不是有注释么,已经很详细了。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询