Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

input string a list in java

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import java.util.Collections;
import java.util.Arrays;

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

    System.out.println("Insert the first series of numbers: ");
    String number1 = input.nextLine();
    System.out.println("Insert the second series of numbers: ");
    String number2 = input.nextLine();

    String[] items = number1.split(" ");
    String[] items2 = number2.split (" ");

    List<String> itemList = new ArrayList<String>(Arrays.asList(items));
    itemList.remove(0);
    Collections.sort(itemList);
    System.out.println(itemList);


} // End of main method
Comment

PREVIOUS NEXT
Code Example
::  
::  
::  
::  
::  
::  
::  
::  
::  
::  
::  
::  
Java ::  
:: java printf double 2 decimal places 
Java :: package within another java 
::  
::  
::  
::  
Javascript ::  
::  
::  
::  
::  
::  
::  
::  
::  
::  
Javascript ::  
ADD CONTENT
Topic
Content
Source link
Name
6+8 =