Write the syntax to input an integer through scanner class with an example
Answers
Answered by
6
Answer:
please mark my answer as brainlist answer
Explanation:
Statement n = s. nextInt(); is used to input the value of an integer variable 'n' from the user. Here, nextInt() is a method of the object s of the Scanner class. Let's see an example in which we will input an integer value from the user.
Example: Program to read the number entered by user. We have ... Then we are using nextInt () method of Scanner class to read the integer. If you are ... Writing your First Java Program
Similar questions
India Languages,
3 months ago
Biology,
3 months ago
Physics,
6 months ago
Sociology,
11 months ago
English,
11 months ago