Friday, May 20, 2016

Java : Reading different data types

import java.util.Scanner;

public class Solution {

    public static void main(String[] args) {
            Scanner sc=new Scanner(System.in);
            int x=sc.nextInt();
            double y=sc.nextDouble();
            String s = sc.nextLine();
       
            //Complete this code
            System.out.println("String: "+sc.nextLine());
            System.out.println("Double: "+y);
            System.out.println("Int: "+x);


    }
}

No comments:

Post a Comment