• www.uptuexam.com
  • GBTU Results 2014
  • MTU Results 2014
  • UPTU Circulars
  • COP Result 2012,13,14
  • UPTU Previous Papers
  • GATE study material
  • Robotics Projects
Thank you for visiting www.UPTUexam.com " Free download Exam materials, previous year question papers, free ebooks & Providing Important Questions To Do their Exams Well and Totally a FREE SERVICE for all engineering streams (B.Tech)."

Question : Why command-line arguments?


Question : Why command-line arguments?

c:\>java Adder 10    20
Command line argument

Result is : 30




Explanation of:



[System.out.println();]


System – It is a pre-defined class in java.lang package

out - it is a static variable inside System class of type PrintStream(class reference variable) (i.e.) static PrintStream out;
and PrintStream is a predefined class in java.io package.
Since it is static that’s why we are calling
       System.out
So,  System.out means we are getting the reference to the object of type PrintStream

println()– It is the method in PrintStream class for Standard output stream.
So to access println method , we need PrintStream object which we are getting through System.out.

  So finally its System.out.println---- to produce standard output Stream.



class PrintStream
{
               public void print(String s)
{
               -----------
               -----------
               -----------
}

public void println(String s)
{
               -----------
               -----------
               -----------
}
-------------
-------------
}

                 class System
            {
public static PrintStream out;
-------------
-------------
-------------
}















No comments:

Post a Comment

Google+ Followers