Tuesday, October 22, 2019


Question

In this challenge, you must read an integer, a double, a string and a character from keyboard, then print the values

Program

package inout;

import java.util.Scanner;

public class Inout
{
    public static void main(String[] args)
    {
        Scanner in =  new Scanner(System.in);
        String s = in.nextLine();
        char c = in.nextLine().charAt(0);
        int x = in.nextInt();
        double d = in.nextDouble();
        System.out.println("Integer- " +  x);
        System.out.println("Double- " +  d);
        System.out.println("String- " + s);
        System.out.println("Char- " + c);
    }
   
}

Video explanation



No comments:

Post a Comment