Ask Question
4 December, 19:29

1) Type a statement that gets an input value into variable numBers. Assume scnr already exists and numBers has been declared.

+5
Answers (1)
  1. 4 December, 22:55
    0
    Following are the code in the java language

    numBers = scnr. nextInt ();

    Here scnr is an instance of scanner class.

    Explanation:

    In this code, we take the input by using the object of Scanner class i. e "scnr". The scanner class in the java programming language is used for taking the input by the user. The scnr. nextInt () is taking the input which is stored in the "numbers" variable.

    So the whole program is looking like that

    import java. util.*; / / import package

    public class Main

    {

    public static void main (String[] args) / / main function

    {

    int numBers; / / variable declaration

    Scanner scnr=new Scanner (System. in); / / create the instance of scanner class

    numBers=scnr. nextInt (); / / taking input

    System. out. println (numBers); / / display the value of numBers

    }

    }

    Output:

    78

    78
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “1) Type a statement that gets an input value into variable numBers. Assume scnr already exists and numBers has been declared. ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers