Friday, July 30, 2010

Output or write on Standard output in java

print
double x=5;
System.out.print(x);

println
This will print the item and put the cursor in new line.
System.out.println(x);

printf
System.out.printf("Hello, %s. Next year, you'll be %d", name, age);

write
System.out.write(x);
It is simpler to use print and println than write.

You can see formatting output in java here.

No comments:

Post a Comment

Chitika