• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Command line arguments

 
aswin penugonda
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
class Main
{
public static void main (String[] args)
{
System.out.println(args);
}
}

Output:
java.lang.String@1a46e30

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
Posts: 774
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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,
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic