About 50 results
Open links in new tab
  1. 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 …

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

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

  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 many characters can a Java String have? - Stack Overflow

    Jul 24, 2009 · Java 9 is going to use a single byte per character for strings having only iso-latin-1 content, so such strings can have as many characters as the heap in bytes (or max array length, …

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

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

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

  10. java - What is the "String [] args" parameter in the main method ...

    May 21, 2009 · That String[] args part may become optional in future versions of Java. Work is underway to allow for simplified declaration of main method. See JEP 463: Implicitly Declared …