GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing www.tutorialspoint.com — Java.io.PrintStream.format() Method
Selected Reading
Java.io.PrintStream.format() MethodDescriptionThe java.io.PrintStream.format() method writes a formatted string to this output stream using the specified format string and arguments. DeclarationFollowing is the declaration for java.io.PrintStream.format() method. public PrintStream format(String format,Object... args) Parameters
Return ValueThis method returns this output stream. Exception
ExampleThe following example shows the usage of java.io.PrintStream.format() method. package com.tutorialspoint;
import java.io.*;
public class PrintStreamDemo {
public static void main(String[] args) {
String s = "Hello World";
// create printstream object
PrintStream ps = new PrintStream(System.out);
// format a string
ps.format("This is a %s program", s);
// flush the stream
ps.flush();
}
}
Let us compile and run the above program, this will produce the following result − This is a Hello World program java_io_printstream.htm
Advertisements
|
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |