• Post Reply Bookmark Topic Watch Topic
  • New Topic

syntx Error  RSS feed

 
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can any one explain me why java compiler does not detect syntax error
from the following program.i checked it on many IDEs and Text pad.
I have appended extra comma after the last element of the array.






OutPut is 4.
 
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
faisal hameed wrote:Can any one explain me why java compiler does not detect syntax error


Because it's not a syntax error. The Java language Specification explicitly states that trailing commas in array initialisations are allowed.
 
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Because it's not a syntax error.

Dangit.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!