Win a copy of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications this week in the Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Fill in the blank  RSS feed

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In an Java application program, what are the appropriate modifiers and return types for the main method declaration ? Write down the keywords in the correct order, choosing the following keyword list.
private protected public abstract static boolean void synchronized final Object native transient
The answer is public static void main(String[] args), though String[] args not in the above list. How Exam consider this answer ?.
In case if we say public static void main(String args[]), will the Exam consider this one is correct ?
 
Tony Alicea
Desperado
Sheriff
Posts: 3226
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you copied the question correctly, it doesn't ask about argument list, only about return type and access modifier. So the answer is <CODE>public static void main</CODE> OR <CODE>static public void main</CODE>.
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes...Tony, I copied exact and surprised to see Bill Brogden includes String[] args in his answer.
Again....
Hoping that Exam will consider both public static void main and static public void main as correct answer.
 
Tony Alicea
Desperado
Sheriff
Posts: 3226
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Brogden corrected that a long time ago. It is in his errata Web page. It is critical to get the errata for tech books. Brogden is very good at maintaining one.
 
Tony Alicea
Desperado
Sheriff
Posts: 3226
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
CORRECTION TO MY POST ABOVE:
The correct answer is
<CODE>public static void</CODE>
OR
<CODE>static public void</CODE>
main is not in the given list.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!