Java Question-5 Declare and initialize two variables called first and second. Write a single statement that will print the message "first is " followed by the value of first, and then space, followed by "second = ", followed by the value of the second. Ex: first is 55 second = 123

Respuesta :

import java.util.Scanner;

public class HelloWorld {

   public static void main(String[] args) {

       Scanner reader = new Scanner(System.in);

       System.out.print("Enter two number: ");

       int number1 = reader.nextInt();

       int number2 = reader.nextInt();

       // println() prints the following line to the output screen

       System.out.println("The first is " + number1+" and second= "+number2);

   }

}