About 50 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. 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 varargs you can call …

  3. 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 …

  4. 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 …

  5. difference between new String[]{} and new String[] in java

    String = new String[10]{}; //The line you mentioned above Was wrong because you are defining an array of length 10 ([10]), then defining an array of length 0 ({}), and trying to set them to the same array …

  6. How do I split a string in Java? - Stack Overflow

    Nov 20, 2016 · String string = "004-034556"; String[] parts = string.split("-"); String part1 = parts[0]; // 004 String part2 = parts[1]; // 034556 Note that split 's argument is assumed to be a regular expression, …

  7. java - How to convert a char to a String? - Stack Overflow

    Nov 17, 2011 · String.valueOf(char) "gets in the back door" by wrapping the char in a single-element array and passing it to the package private constructor String(char[], boolean), which avoids the …

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

  9. Java - Convert integer to string - Stack Overflow

    Returns a String object representing the specified integer. The argument is converted to signed decimal representation and returned as a string, exactly as if the argument and radix 10 were given as …

  10. 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 character in the …