User input numbers not adding together

后端 未结 3 1390
轻奢々
轻奢々 2021-01-27 02:46

I\'m trying to write a program that reads an integer from the user (through the keyboard), adds 100 to it and displays the result. All I can do is get them to concatenate like 2

3条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-27 03:21

    Text is the String, number an int, thus use:

    System.out.println(" Your value + 100 is " + ( 100 + number));
    

    For Strings + concatenates.

提交回复
热议问题