Showing posts with label System.out.println. Show all posts
Showing posts with label System.out.println. Show all posts

How to Simulate System.out.println

How to Simulate System.out.println() ?

// Class A Will Work like PrintStream Class
class A
{
// printp Function will replace println()
public void printp()
{
System.out.println("Testing");
}
}

// Class B Will Work like System Class
class B
{
//Here a is like out
public static A a=new A();
}

class C
{
public static void main(String args[])
{
// System.out.println();
B.a.printp();
}
}

Watch Following Video to Learn in Detail :

What is System.out.println

What is System.out.println() ?

//Code is start from here
import java.io.*;

//Kapil will Replace the System
class Kapil 
{
//shukla will Replace the out
public static PrintStream shukla = new PrintStream(System.out);
}

class Txt
{
          public static void main(String args[])
{
           // Kapil.shukla can be used in place of System.out
           Kapil.shukla.println("Hello World");
}
}

Watch Following Video to Learn in Detail :