About 31,100,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 into a …

  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. That's …

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

    The convention is to use String[] as the main method parameter, but using String... works too, since when you use varargs you can call the method in the same way you call a method with an array as …

  4. 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 according to their …

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

    The first thing to do is to receive the input, in this case, a string of digits; I'll call it String number, and in this case, I'll exemplify it using the number 12, therefore String number = "12"; Another limitation was …

  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. Append a single character to a string or char array in java?

    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.

  8. 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?

  9. 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.

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

    So in the string "foo", if I asked for the character with index 0 it would return "f". Note - in the above question, by "character" I don't mean the char data type, but a letter or number in a string.