Ask Question
15 December, 09:06

I don't know the answer and I tried different ones and they not what the book is looking for.

Write a statement that outputs variable numObjects. End with a newline.

Program will be tested with different input values.

import java. util. Scanner;

public class VariableOutput {

public static void main (String [] args) {

int numObjects;

Scanner scnr = new Scanner (System. in);

numObjects = scnr. nextInt (); / / Program will be tested with values: 15, 40.

Then I have to write my code below this and I don't know what to put.

+1
Answers (1)
  1. 15 December, 10:55
    0
    The complete program is:

    import java. util. Scanner;

    class Main

    {

    public static void main (String [] args) {

    int numObjects;

    Scanner scnr = new Scanner (System. in);

    numObjects = scnr. nextInt (); / / Program will be tested with values: 15, 40.

    System. out. println (numObjects);

    }

    }

    Explanation:

    The program is as mentioned above, And we can check with inputs 15, and 40. And it was found that correct answer is obtained on running the program.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “I don't know the answer and I tried different ones and they not what the book is looking for. Write a statement that outputs variable ...” 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