We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
The error is because there exists no method called "println" that has the signature (String, Object...), which is what you're attempting to write. It has nothing to do with the functionality of the println method. System.out.println takes an Object argument only, and is used to simply print an Object's String representation (via toString) to the console with a trailing newline. System.out.printf is used for formatted output, and requires the \n for printing the newline.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Java Output Formatting
You are viewing a single comment's thread. Return to all comments →
The error is because there exists no method called "println" that has the signature (String, Object...), which is what you're attempting to write. It has nothing to do with the functionality of the println method. System.out.println takes an Object argument only, and is used to simply print an Object's String representation (via toString) to the console with a trailing newline. System.out.printf is used for formatted output, and requires the \n for printing the newline.