Retouch Print facility in Java

In this article you can get a great idea about how to use the various output statements in Java. While you print a statement, there resides several transaction between the Program and the JVM(Java Virtual Machine).In Java , all are byte based streams for reading input and showing result as output.In order to understand Java I/0 , you have to know how java deals with various integers, characters,bytes and other primitive data types. Most important thing is that to analyze  transformation of data types from one to another 

// Comment
package allinalljava;

 * @author Sabari Raja
public class SamplePrintf {

     * @param args the command line arguments
    public static void main(String[] args) {
        // TODO code application logic here
        System.out.print("Welcome to Java Again");
        System.out.print("pure coffee");
        System.out.println("\ntaste me again");

In the above program, I have shown various possible ways of printing output streams. Here print(“ “) is normal operation like printing a sample text. While write(int) is some thing different. Its converts numeric value to byte. Usually write(9) is similar to using ‘\t’. Printf(“%d”,value) this method of printing is similar to printf in C. From release of Jdk 5.0, we have this facility of using printf. Println is for printing the statement with end of line. Main use to start newline.

Welcome to Java Again
100%     pure coffee
taste me again
test Web Developer

No comments:

Post a comment

Related Posts Plugin for WordPress, Blogger...