Ask Question
21 July, 22:40

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

public class VariableOutput {

public static void main (String [] args) {

int numObjects;

numObjects = 15; / / Program will be tested with values: 15, 40.

+4
Answers (1)
  1. 22 July, 00:03
    0
    The code is witten in Java and given in the explanation section.

    Using a Scanner object we receive a the user's input and with the System. out. println we output the variable

    Explanation:

    import java. util. Scanner;

    public class VariableOutput{

    public static void main (String [] args) {

    Scanner input = new Scanner (System. in);

    System. out. println ("Enter an Integer 15 or 40");

    int numObjects = input. nextInt ();

    System. out. println ("You entered the number "+numObjects);

    }

    }
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Write a statement that outputs variable numObjects. End with a newline. public class VariableOutput { public static void main (String [] ...” 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