Java PrintStream.print(char[] s)
Syntax
PrintStream.print(char[] s) has the following syntax.
public void print(char[] s)
Example
In the following code shows how to use PrintStream.print(char[] s) method.
//from w ww . j a v a 2s .co m
import java.io.*;
public class Main {
public static void main(String[] args) {
char[] s = {'a', 'b', 'c'};
char[] c = {'H', 'e', 'l', 'l', 'o'};
PrintStream ps = new PrintStream(System.out);
// print char array
ps.print(s);
ps.print(c);
// flush the stream
ps.flush();
}
}
The code above generates the following result.
Home »
Java Tutorial »
java.io »
Java Tutorial »
java.io »