Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

How can I store user inputs in an array of integers?

  public static void main(String[] args) {
      
        Scanner input = new Scanner(System.in);
      
        int[] xr = new int[5];

        for (int i = 0; i < xr.length; i++) {
            xr[i] = input.nextInt();
        }

        System.out.println(Arrays.toString(xr));
    }
Comment

PREVIOUS NEXT
Code Example
Java :: how to write to a txt file in java in the end 
Java :: java Difference Array | Range update query in O(1) 
Java :: ASCII PrintWriter java.io examples 
Java :: java writing an object 
Java :: text field background color swing 
Java :: java check if a line is enclosed in quotation marks 
Java :: focus_button_java_swing 
Java :: java thread syncronized locker 
Java :: What is the name of the Android function that is used to update the UI (user interface) from a background thread? 
Java :: select class field from list java 
Java :: how to secure specific url in spring security 
Java :: create object in java without new keyword 
Java :: resultset previous 
Java :: how to check if a value is integer or not in java 
Java :: string split to list java 
Java :: Java 8 merge multiple collections using flatmap 
Java :: java union of sets 
Java :: Java Private Access Modifier Error when we call it 
Java :: edit activity main drawer items text color android 
Java :: verificar numero par ou impar jacva 
Java :: how to open a desktop application using java 
Java :: java gui lookandfeel flatlaf background color 
Java :: first method in jdbc 
Java :: spigot give item 
Java :: ratespiel java 
Java :: java multiple implements 
Java :: binomial heap implementation java 
Java :: Spring AOP 
Java :: convert object address to string in java 
Java :: java list comparator lambda 
ADD CONTENT
Topic
Content
Source link
Name
9+9 =