Package java.io
Class PrintStream

Public Method print

void print(boolean b)

void print(char c)

void print(char[] s)

void print(float f)

void print(int i)

void print(Object obj)

void print(String s)

_INSERT_METHOD_SIGNATURE_HERE_

Description:

print(boolean b) method:

Print a boolean value. The return value of String.valueOf(boolean) is translated into bytes according to the default platform character endcoding and these bytes are written as with write(int).

print(char c) method:

Print a character. The character is translated into the platform's default character encoding and these bytes are written as with write(int).

print(char[] s) method:

Print an array of characters. The characters are converted into bytes according to the default encoding of the platform and these bytes are written as with write(int).

print(float f) method:

Print a floating-point number. The string produced by String.valueOf(float) is translated into bytes according to the default encoding of the platform and these bytes are written as with write(int).

print(int i) method:

Print a integer number. The string produced by String.valueOf(int) is translated into bytes according to the default encoding of the platform and these bytes are written as with write(int).

print(Object obj) method:

Print an object. The string produced by String.valueOf(Object) is translated into bytes according to the default encoding of the platform and these bytes are written as with write(int).

print(String s) method:

Print a string. If the argument is null the string "null" is printed, otherwise the characters of the string are converted into bytes according to the default encoding of the platform and these bytes are written as with write(int).

Example

   File file = new File("testFile");
   String fileString = "Hello World";
   OutputStream fos = new FileOutputStream(file);
   PrintStream ps = new PrintStream(fos);
   ...
   ps.print(fileString);

The example above prints the specified string to the file.