• Post Reply Bookmark Topic Watch Topic
  • New Topic

Illegal start of expression  RSS feed

 
Olaoluwa Odusegun
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, I need to know why this program is giving me error (illegal start of expression). What must i do to stop the error?

 
Joanne Neal
Rancher
Posts: 3742
16
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have a look here at the two examples of method signatures that include a throws clause and see how they differ from yours.
As a clue I will tell you it is only one character that is causing the problem.
 
Devendra Katiyar
Greenhorn
Posts: 3
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,

I check the program ,There was invalid '{' Before the Exception thorws in main Method .



 
Olaoluwa Odusegun
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot. It worked.
 
Campbell Ritchie
Marshal
Posts: 56584
172
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That error might have been easier to find if you had consistent indentation in your code. There are two common indentation conventions:
  • 1: Each { and each } is on a line by itself.
  • 2: Each { is at the end of the line and each } is on a line by itself.
  • I prefer No 1. We have some suggestions here. You are allowed to write {...} on one line for array initialisers.
    To maintain indentation you need to write backwards, and the suggestions about code editors here will also help you.
     
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!