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

Enthuware question

 
Daniel Martins
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


According to the answer provided, answer 2 is correct but I don't think so...
 
Ankit Garg
Sheriff
Posts: 9529
33
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Both 1 and 2 looks like the correct answers to me, why do you think 2 is not the right answer??
 
Daniel Martins
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
exit without any output and exceptions if no arguments are given?

But no arguments means args.length=0 and will lead to arg[-1] bellow.

System.out.println(args[args.length-1]);

What did I miss?

 
Jack Bento
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Daniel Martins wrote: args.length=0 and will lead to arg[-1]


and that will throw the exception and output nothing
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic