About 302,000 results
Open links in new tab
  1. How can I declare dynamic String array in Java - Stack Overflow

    Apr 28, 2015 · It's worth your time to read up on ArrayList instead. The Array.newInstance(Class<?> componentType, int length) method is to be used to create an array with dynamically length. Multi-dimensional arrays can be created similarly with the Array.newInstance(Class<?> componentType, int... dimensions) method.

  2. java - How to pass dynamic string values to a method ... - Stack Overflow

    Aug 14, 2019 · verifyFilesInFolder(String folder, String ...strings) { List<String> list = Arrays.asList(strings); for (String s : list) System.out.println(s); } Some inputs/outputs: verifyFilesInFolder("folder", "item1"); -> prints "item1"

  3. Java User Input (Scanner class) - W3Schools

    To use the Scanner class, create an object of the class and use any of the available methods found in the Scanner class documentation. In our example, we will use the nextLine() method, which is used to read Strings: If you don't know what a …

  4. initialize string dynamically in java - Stack Overflow

    Jan 18, 2014 · You can use Guava's Strings.repeat() method: String str = Strings.repeat("8", count);

  5. How to read or input a string? - GeeksforGeeks

    Apr 24, 2025 · How to Read or Input a String in Java. In Java, we can use Scanner Class or InputStream to Read the string. In below code, we will try to use the Scanner class instance to read the string.

  6. Making a String That Can Contain Dynamic Information - Java2s

    System.out.printf () method can be used to position dynamic values within a String. public static void main(String [] args){ double temperature = 98.6; System.out.printf("The current temperature is %.1f degrees Fahrenheit.\n", temperature);

  7. How to access data dynamically in Java without losing type safety

    Mar 28, 2021 · There are two ways to provide dynamic data access in Java: Represent data with classes (or records in Java 14) and use reflection; Represent data with string maps; The purpose of this article is to illustrate various ways to access …

  8. Mastering Java 21 String Templates: A Comprehensive Guide

    In this tutorial, we delve into the new String Templates feature introduced in Java 21. String Templates streamline the process of creating dynamic strings, making the code cleaner and easier to read.

  9. Hands on Java 11’s constantdynamic - Java Code Geeks

    Aug 7, 2018 · In short, by using invokedynamic it has become possible to delay the binding of a method call until its first invocation. This technique is for example used by the Java language to implement lambda expressions which are only manifested on demand upon their first use.

  10. substring - Parse dynamic string in java - Stack Overflow

    Oct 9, 2012 · You can make use of split method with ":" parameter. The split (String regex) method (used on a String object) returns an array of Strings, that were separated in the object by a regex. In this case it will return an array like: {"6,image micky,jpeg","7,image 02.jpeg","8,img3"} Then you can iterate through this array and use split again.

  11. Some results have been removed
Refresh