avatar
read integer, double, and String from stdin Java

• Be assumption that stdin has three lines with order: integer, double and string.

public static void main(String[] args) {
	Scanner scan = new Scanner(System.in);
	int a = scan.nextInt();
	double b = scan.nextDouble();
	scan.nextLine();
	String c = scan.nextLine();
	System.out.println("String: " + c);
	System.out.println("Double: " + b);
	System.out.println("Int: " + a);
	scan.close();
}

Note: scan.nextLine() will past the current line and returns the input that was skipped.

You need to login to do this manipulation!