小编use*_*007的帖子

从int到String的随机元素?

好的,所以我先显示我的代码,然后我会解释我需要帮助的内容.

  Random isServerChance = new Random();
  Random isGood = new Random();
  Random isBad = new Random();

  // Some IDs which are considered "Good"
  int isGoodTable[] =
  { 1038, 1040, 1042, 1044 };
  // Some IDs which are considered "Bad"
  int isBadTable[] =
  { 6570, 6585, 952, 969 };
  // Based on this roll, will pick which cat is used. Good, or Bad.
  int isServerRoll = isServerChance.nextInt(6);
  // If it's > 3 it's going to be a "Good" item, if it's …
Run Code Online (Sandbox Code Playgroud)

java arrays

2
推荐指数
1
解决办法
107
查看次数

Java整数与字符串?

我想知道是否有可能编造一个命令,让我们说我们有一个Scanner.

这是一个例子:

Scanner INPUT = new Scanner(System.in);
int IsPoints = 0;
String isValue = INPUT.nextLine();

if (isValue.equalsIgnoreCase("give"){
   isPoints += The int value you want here;
}
Run Code Online (Sandbox Code Playgroud)

所以我真正的问题是,是否可以int通过String命令增加点的值?

输出,如果有效,将给出X(你想要的点数= x)

所以,如果我确实给了50005000得分,那可能吗?

谢谢

java string int

0
推荐指数
1
解决办法
126
查看次数

标签 统计

java ×2

arrays ×1

int ×1

string ×1