Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

how to take space separated input in java

String s[]= scanner.nextLine().split(" ");for(int i =0 ;i < s.length;i++){    a[i]= Integer.parseInt(s[i]);}
Comment

how to take space separated input in java

 Scanner scanner = new Scanner(System.in);
 int numOfBlocks = scanner.nextInt();
 int weightArray[] = new weightArray[numOfBlocks];
 for(int i=0;i<numOfBlocks;i++)
       {
        weightArray[i] = scanner.nextInt();
       }
 scanner.close();
//your logic
Comment

PREVIOUS NEXT
Code Example
Java :: gradle fatjar 
Java :: how to make an invisiblke button in swing 
Java :: android back navigation 
Java :: java jackson cast to list 
Java :: take string array input in java 
Java :: activity as a splash screen java code 
Java :: java how to get deltaTime 
Java :: fullscreen jframe 
Java :: making matrix in java 
Java :: format localdate java 
Java :: how to check keyboard is open or not in android 
Java :: android parse date 
Java :: find number of days between two local dates in java 8 
Java :: java ldaps certificate self signed 
Java :: puissance java 
Java :: events that people think are unlikely but actually have high probability 
Java :: appcompatdelegate.setdefaultnightmode(appcompatdelegate.mode_night_yes) not working 
Java :: pyramid star pattern in java 
Java :: android how to switch between activities 
Java :: spring h2 database dependency 
Java :: How to find the power of a number efficiently in Java? 
Java :: java enum get first element 
Java :: spring data rest format time and date 
Java :: 2 power 8 in java 
Java :: How to perform an iterative depth first search through a binary tree, in Java? 
Java :: java public static void main 
Java :: discord jda get message by id 
Java :: How to efficiently generate all combinations of well-formed parentheses for n pairs of them, in Java? 
Java :: android studio get string 
Java :: Java code to print odd number 
ADD CONTENT
Topic
Content
Source link
Name
7+1 =