Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

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
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #space #separated #input #java
ADD COMMENT
Topic
Name
8+9 =