60.6k views
3 votes
How can you read three different values using scanner java

User BuguiBu
by
7.7k points

1 Answer

2 votes

Step-by-step explanation:

import java.util.Scanner;

public class ReadValues {

public static void main(String[] args) {

Scanner scanner = new Scanner(System.in);

System.out.print("Enter the first value: ");

double firstValue = scanner.nextDouble();

System.out.print("Enter the second value: ");

double secondValue = scanner.nextDouble();

System.out.print("Enter the third value: ");

double thirdValue = scanner.nextDouble();

System.out.println("You entered: " + firstValue + " " + secondValue + " " + thirdValue);

User Matheus Bica
by
7.4k points