Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

take string array input in java

String[] array = new String[20];

        System.out.println("Please enter 20 names to sort: ");              
        Scanner s1 = new Scanner(System.in);

        for (int i = 0; i < 20;){

            array[i] = s1.nextLine();


        }
Comment

input array in String in java

import java.util.Scanner;
public class NameSorting {

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

        System.out.println("Please enter 20 names to sort");              
        Scanner s1 = new Scanner(System.in);
        for (int i = 0; i < 0;){

            array[i] = s1.nextLine();


        }


        //Just to test
        System.out.println(array[0]);

    }

}
Comment

PREVIOUS NEXT
Code Example
Java :: java find item in list by property 
Java :: ova definition 
Java :: processing draw circle 
Java :: java deltaTime 
Java :: stream to list 
Java :: fullscreen java jframe 
Java :: making matrix in java 
Java :: how to get time in dd/mm/yyyy format in java 
Java :: java for schleife 
Java :: how to clear stringbuilder in java 
Java :: read file using scanner in java 
Java :: prime check jaba 
Java :: java copy list 
Java :: heroku java 17 enable preview 
Java :: spigot run code asynhronously 
Java :: intent android open activity 
Java :: how to convert int to string java 
Java :: toString convert to long 
Java :: java convert double to string 
Java :: xAxis.setTextSize() text gets clipped 
Java :: go to activity android 
Java :: rates api 
Java :: how to find smallest number in array java 
Java :: alertdialog show in android 
Java :: circular list java 
Java :: set precision in java 
Java :: add value with n variable with Arraylist in java 
Java :: Lunar New Year 
Java :: play sound on button click android studio 
Java :: java jdk java_home home ubuntu openjdk-8-jdk 
ADD CONTENT
Topic
Content
Source link
Name
4+4 =