How to take user input in java

How to take user input in java

Program code:

import java.util.Scanner;
public class input_operator {
    public static void main(String args[])
        Scanner Sc = new Scanner(;
        System.out.println("Enter an integer value");
        int a = Sc.nextInt();
        System.out.println("You entered: " + a);

        System.out.println("Enter a float value");
        float b = Sc.nextFloat();
        System.out.println("You entered: " + b);

        System.out.println("Enter your first name");
        String c =;
        System.out.println("You entered: " + c);


About the Author: Make toss

Leave a Reply

Your email address will not be published. Required fields are marked *