About 218,000 results
Open links in new tab
  1. What's the simplest way to print a Java array? - Stack Overflow

    Starting with Java 8, one could also take advantage of the join() method provided by the String class to print out array elements, without the brackets, and separated by a delimiter of choice …

  2. Printing string variable in Java - Stack Overflow

    Scanner input = new Scanner(System.in); String data = input.nextLine(); System.out.println(data); Please read the tutorial on how to use it as it will explain all. Edit

  3. Reverse a string in Java - Stack Overflow

    String testString = "Yashwanth@777"; // ~1 1⁄4→D800₁₆«2²⁰ Using Java 8 Stream API. First we convert String into stream by using method CharSequence.chars(), then we use the method …

  4. string - How do I print my Java object without getting "SomeType ...

    Mar 19, 2015 · To print something different when you call System.out.println(myObject), you must override the toString() method in your own class. Here's a simple example: public class …

  5. Java: how to print an entire array of strings? - Stack Overflow

    Feb 6, 2014 · I'm trying to print an array of seven strings, and am using a get method to return them to the min before printing, but whenever I run it some random gibberish shows up on the …

  6. How to print out all the elements of a List in Java?

    Apr 16, 2012 · System.out.println(list) should print all the standard java object types (String, Long, Integer etc). In case, if we are using custom object types, then we need to override toString() …

  7. java - How to println a string and variable within the same …

    You either need to use + to concatenate, or use String.format to format a string or similar. The easiest is to do concatenation: System.out.println("randomtext" + var); Some people often use …

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

    You see here that the string literal is indented to look nice within the .java file. The Java compiler removes this incidental whitespace and keeps the essential whitespace. Then the …

  9. How to format strings in Java - Stack Overflow

    Format-first since Java 15, alternative to String#format. There is a new instance method called String#formatted(Object... args) as of Java 15. The internal implementation is the same as …

  10. Pretty-Print JSON in Java - Stack Overflow

    Nov 5, 2010 · Here is a simple code to pretty print a JSON string, only using general Java APIs (available in Java 7 for higher; haven't tried older version although). The basic idea is to tigger …

Refresh