Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Zeroth element of the string array passed to the main method contains what ?

 
Sathi Krishna
Ranch Hand
Posts: 51
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What does the zeroth element of the string array passed to the public static void main method contain?

A. The name of the program
B. The number of arguments
C. The first argument if one is present

Please Let Me Know the Answer !!

 
Swastik Dey
Rancher
Posts: 1625
5
Android Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
C. The first argument if one is present
 
Sebastian Janisch
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why don't you just try it out ? ;)

The string array contains the arguments passed to the program separated by space.
So array[0] contains the first argument.
 
sujith Acharya
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The first argument if its present
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15484
43
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sathi, welcome to JavaRanch.

We have a rule here: when you copy a question from a book, mock exam or other source, we require that you quote your sources. So, please tell us where you got this question from.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic