You are viewing a single comment's thread. Return to all comments →
Simply take all the inputs in string and convert them to their respective data types before printing through type casting.
import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner scan = new Scanner(System.in); String i = scan.nextLine(); String d=scan.nextLine(); String s=scan.nextLine(); System.out.println("String: " + s); System.out.println("Double: " + Double.valueOf(d)); System.out.println("Int: " + Integer.valueOf(i)); } }
Seems like cookies are disabled on this browser, please enable them to open this website
Java Stdin and Stdout II
You are viewing a single comment's thread. Return to all comments →
Simply take all the inputs in string and convert them to their respective data types before printing through type casting.