KnowledgeBoat Logo

Computer Science

Write down the syntax with reference to Java Programming:

to accept a fractional number

Input in Java

1 Like

Answer

//Input through InputStreamReader Class
InputStreamReader read = new InputStreamReader(System.in);
BufferedReader in = new BufferedReader(read);
double d = Double.parseDouble(in.readLine());
//Input through Scanner Class
Scanner in = new Scanner(System.in);
double d = in.nextDouble();

Answered By

3 Likes


Related Questions