• Post Reply Bookmark Topic Watch Topic
  • New Topic

error: semicolon expected  RSS feed

 
Shafiul Alam
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I am a beginner in java programming. I am completely lost here. This code is throwing the following two errors
Euler3.java:20: error: ';' expected
boolean checkPrime
( int x){
Euler3.java:20: error: ';' expected
boolean checkPrime(int x
) {
2 errors


Could anybody please enlighten me what's wrong with this code? Here is the code:

 
Paweł Baczyński
Bartender
Posts: 2074
44
Firefox Browser IntelliJ IDE Java Linux Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can't declare a method inside another method.
Move boolean checkPrime(int x) method out of main method.
Also mark it as static or it won't work.
 
Shafiul Alam
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks got it.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!