I wrote a programe which will let you knwo why we always use System.out.print() to print something in java. This simple program will give you clear idea...
package com.util;
import java.io.*;
class Print extends PrintStream
{
public void it(String a) // this method is same as print()
{
super.println(a);
}
Print()
{
super(System.out);
}
}
class Please
{
static Print print=new Print();
}
public class Test1 {
public static void main(String[] args) {
Please.print.it("hi");
}
}
Hope this helps ;)
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment