Java Online Compiler
Example: Java program to take inputs from the user
C
C++
C#
Java
Python
PHP
Main.java
STDIN
Run
// Java program to take inputs from the user import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.println("Enter the integer value::\n"); int p = in.nextInt(); System.out.println("Enter the float value::\n"); float q = in.nextFloat(); System.out.println("Enter the string value::\n"); char r = in.next().charAt(0); // Output System.out.println("\nThe integer input is:\n" + p); System.out.println("\nThe float input is:\n" + q); System.out.println("\nThe string input is:\n" + r); } }
5 7.5 h
Output
Clear
ADVERTISEMENTS