Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

input in integer java

import java.util.Scanner;

public class Demo {

    public static void main(String[] args) {

        /* This reads the input provided by user
         * using keyboard
         */
        Scanner scan = new Scanner(System.in);
        System.out.print("Enter any number: ");

        // This method reads the number provided using keyboard
        int num = scan.nextInt();

        // Closing Scanner after the use
        scan.close();
        
        // Displaying the number 
        System.out.println("The number entered by user: "+num);
    }
}
Comment

read integer input java

BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int a = Integer.parseInt(br.readLine());
Comment

PREVIOUS NEXT
Code Example
Java :: how to create a circle in java 
Java :: android use attribute color programmatically 
Java :: how to make int array java android 
Java :: convert int to string java 
Java :: get first letter of string in array java 
Java :: spring boot procfile run profile 
Java :: how to add elements in array in java using for loop 
Java :: euclids algoritm java gcd 
Java :: java foreach 
Java :: arrays sort 2d array java 
Java :: java selenium send keys numbers 
Java :: jsonarray to list java 
Java :: change button text onclick java 
Java :: how to end a program in an if statement java 
Java :: convert bytebuffer to string 
Java :: get type java 
Java :: java indexof array 
Java :: Cannot invoke toString() on the primitive type int 
Java :: how to acces every char of a String in java 
Java :: view binding in recyclerview adapter android java 
Java :: spring boot docker 
Java :: java random array 
Java :: android studio pass value to another activity 
Java :: add view to relativelayout programmatically 
Java :: java quotes in string 
Java :: convert arraylist to csv file java 
Java :: explicit casting 
Java :: add opacity to activity android 
Java :: how to assert that an exception is thrown java 
Java :: get frequency of letters java 
ADD CONTENT
Topic
Content
Source link
Name
1+5 =