File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Command line arguments Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Command line arguments" Watch "Command line arguments" New topic

Command line arguments

aswin penugonda

Joined: Jun 16, 2009
Posts: 9
class Main
public static void main (String[] args)


Here I am not passing any command line arguments while running this class.But an object is being created why?

Please answer
Prithvi Sehgal
Ranch Hand

Joined: Oct 13, 2009
Posts: 774

If you don't pass anything, an empty String array is created by JVM itself. At the end array is an object.
That's why an object is being printed out.

Hope this helps,

My Blog, Follow me on Twitter,Scjp Tips, When you score low in mocks, Generics,Scjp Notes, JavaStudyGroup
I agree. Here's the link:
subject: Command line arguments
It's not a secret anymore!