About 291,000 results
Open links in new tab
  1. java - How to including variables within strings? - Stack Overflow

    Also consider java.text.MessageFormat, which uses a related syntax having numeric argument indexes. For example, String aVariable = "of ponies"; String string = MessageFormat.format("A …

  2. Java: how to initialize String []? - Stack Overflow

    Apr 1, 2010 · String[] errorSoon = new String[n]; With n being how many strings it needs to hold. You can do that in the declaration, or do it without the String [] later on, so long as it's before …

  3. Java - Create a new String instance with specified length and filled ...

    Nov 26, 2009 · Sometimes you want to create a new string with a specified length, and with a default character filling the entire string. ie, it would be cool if you could do new String(10, '*') …

  4. Create A Java Variable (String) of a specific size (MB's)

    Mar 20, 2010 · Java char s are 2 bytes (16 bits unsigned) in size. So if you want 2MB you need one million characters. There are two obvious issues with your code: Repeatedly calling …

  5. java - How to create JSON Object using String? - Stack Overflow

    Nov 21, 2013 · FYI that this will fail to parse JSON arrays (even though they are technically valid JSON). For example, trying JSONObject("[{\"foo\":2, \"bar\": 3}]"); results in A JSONObject text …

  6. Java - How do I make a String array with values?

    Dec 18, 2011 · I know how to make an empty array, but how do I make a String array with values from the start?

  7. java - Create a string with n characters - Stack Overflow

    May 11, 2010 · Is there a way in Java to create a string with a specified number of a specified character? In my case, I would need to create a string with ten spaces. My current code is: …

  8. Create new object from a string in Java - Stack Overflow

    Apr 22, 2019 · Is there a way to create a new class from a String variable in Java? String className = "Class1"; //pseudocode follows Object xyz = new className(param1, param2); …

  9. How to create an if statement for a String variable in Java?

    Apr 15, 2015 · A String is an object, and you are keeping track of a String through your variable mood. The variable used to keep track of an object is a reference, which is just a memory …

  10. java - Best way to create enum of strings? - Stack Overflow

    Oct 20, 2010 · What is the best way to have a enum type represent a set of strings? I tried this: enum Strings{ STRING_ONE("ONE"), STRING_TWO("TWO") } How can I then use them as …

Refresh