java illegal part of expression

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

cianz182

Thread Starter
Joined
Nov 2, 2011
Messages
2
Hi everyone,

I appear to have some trouble for my java program when trying to compile it comes up with "illegal start of expression"

here is some of my code any help would be appreciated thanks!!
the error is on line 55

46.public int getImp(int[] numb){
47.if(numb[1] == 1 && numb[0] ==0){
48.imp = 0;
49.}
50.else{
51.imp = 1;
52.return imp;
53.}
54.public int checkPred(int n){
55.if(n>=1 && n <= 10 && n/2 <= 5){
56.pred = 1;
57.}
58.else{
59.pred = 0;
60.}
61.return pred;
62. }
63.}
 
Joined
Jul 2, 2006
Messages
379
Hi and welcome,

It would appear that you haven't closed your curly braces for the function getImp

Code:
public int getImp(int[] numb){
    if(numb[1] == 1 && numb[0] ==0){
        imp = 0;
    }
    else{
        imp = 1;
        return imp;
    }
                     [COLOR="Red"] <--Need another } here to finish the method[/COLOR]
public int checkPred(int n){
    if(n>=1 && n <= 10 && n/2 <= 5){
        pred = 1;
    }
    else{
        pred = 0;
    }
    return pred;
}
}                 [COLOR="Red"]  <-- extra } will cause another error - needs removing[/COLOR]
It would help a lot to see errors like this if your code was formatted properly with indents (as above), it would then be obvious that something was missing.

Andy
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Members online

Top