Console output with format : Console « JDK 6 « Java

Console output with format


import java.sql.SQLException;

public class MainClass {
  public static void main(String[] args) throws ClassNotFoundException, SQLException {
    Console console = System.console();
    if (console == null) {
      System.err.println("sales: unable to obtain console");

    console.printf("%s ", "string");


Related examples in the same category

1.Java Console readLine
2.Password Prompting with
3.Console read Password
4.Printing text with the Console class
5.Masking a password with the Console class
6.Use Console class to read user input?