About 12,800,000 results
Open links in new tab
  1. How do I compare strings in Java? - Stack Overflow

    Apr 2, 2013 · String.contentEquals () compares the content of the String with the content of any CharSequence (available since Java 1.5). Saves you from having to turn your StringBuffer, etc …

  2. java - String.equals versus == - Stack Overflow

    Let's see it happen in Java terms. Here's the source code of String's equals() method: It compares the Strings character by character, in order to come to a conclusion that they are indeed equal. …

  3. What is the difference between String[] and String... in Java?

    What's actually the difference between String[] and String... if any? The convention is to use String[] as the main method parameter, but using String... works too, since when you use …

  4. How to format strings in Java - Stack Overflow

    Primitive question, but how do I format strings like this: "Step {1} of {2}" by substituting variables using Java? In C# it's easy.

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

    9 I believe you just migrated from C++, Well in java you have to initialize a data type (other then primitive types and String is not a considered as a primitive type in java ) to use them as …

  6. How can I print a string adding newlines in Java?

    The Java compiler removes this incidental whitespace and keeps the essential whitespace. Then the .indent(4) method call adds four trailing spaces, essential indentation I want to add.

  7. java - Get string character by index - Stack Overflow

    The endIndex (second parameter) of String.substring(int, int) is an exclusive index, and it won't throw an exception for index + 1 as long as index < length() -- which is true even for the last …

  8. Append a single character to a string or char array in java?

    11 You'll want to use the static method Character.toString (char c) to convert the character into a string first. Then you can use the normal string concatenation functions.

  9. How do I convert a String to an int in Java? - Stack Overflow

    Alternatively, you can use an Ints method from the Guava library, which in combination with Java 8's Optional, makes for a powerful and concise way to convert a string into an int:

  10. Converting 'ArrayList<String> to 'String []' in Java - Stack Overflow

    Oct 28, 2010 · How might I convert an ArrayList<String> object to a String [] array in Java?