About 9,390,000 results
Open links in new tab
  1. java - How to store string values in string array? - Stack Overflow

    Sep 5, 2015 · If you're working from the console I think this is the easiest way for a beginner to tackle user input: private static String[] stringArray = new String[3]; // method that reads user …

  2. How to Take Array Input From User in Java? - GeeksforGeeks

    Apr 17, 2025 · First, we create an object of the Scanner Class and import the java.util.Scanner package. Then we use the hasNextInt () and nextInt () methods of the Scanner class to take …

  3. How to take array input from command line in Java ? Scanner ... - Blogger

    Apr 2, 2025 · Depending on which type of array you are taking as input e.g. String or int or any other array, you need to use the next() or nextInt() method to read a value from the command …

  4. Java How To Convert a String to an Array - W3Schools

    There are many ways to convert a string to an array. The simplest way is to use the toCharArray() method: Convert a string to a char array: You can also loop through the array to print all array …

  5. String Arrays in Java - GeeksforGeeks

    Nov 25, 2024 · When we create an array of type String in Java, it is called a String Array in Java. In this article, we will learn the concepts of String Arrays in Java including declaration, …

  6. java - Array of string from the console - Stack Overflow

    Sep 9, 2013 · My idea is: Create array of strings and copy every line from BufferedReader to the array data[i]. Sample of my code: String[] data = new String[n]; int j=0; for (int i = 1; i <= n; i++) …

  7. Storing Java Scanner Input in an Array - Baeldung

    Nov 29, 2023 · In this tutorial, we’ll explore how to save scanner input in an array in Java. 2. Introduction to the Problem. There can be three scenarios when we store the input from a …

  8. How To Store String In Array In Java - TalkersCode.com

    Mar 11, 2024 · For storing a constant number, use a string array. ch[i] = str.charAt(i); } for (char c : ch) { System.out.println(c); } } } The class is then defined as TalkersCode. The Custom input …

  9. String Array in Java - CodeGym

    May 10, 2023 · Here we first create a String array named stringArray with four elements (String musical instruments). Then, both loops iterate through each element of the string array and …

  10. Java String Array- Tutorial With Code Examples - Software …

    Apr 1, 2025 · This tutorial on Java String Array explains how to declare, initialize & create String Arrays in Java and conversions that we can carry out on String Array.