my dog learned polymorphism
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 Elasticsearch in Action this week in the Big Data 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
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: Command line arguments