Results 1 to 4 of 4
  1. #1
    gbonecapone is offline Member
    Join Date
    May 2013
    Posts
    68
    Blog Entries
    1
    Rep Power
    0

    Default illegal start of an expression!!

    i am totally stumped on why im getting these two errors. can someone take a look at it?

    double newT;

    if (newT > t) && (lf > li) ERROR HERE unexpected type. required class. found value.<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    di = (newT - l * dinv - df * ((1 / lf) - dinv)) / ((1 / li) - dinv);
    else{

    //GOTO 1505
    t=ta+ti+tf;
    if (newT < t) && (lf > li) { ERROR HERE ";" expected <<<<<<<<<<<<<<<<<<<<<<<<<<<<
    df = (newT - l * dinv - di * ((1 / li) - dinv)) / ((1 / lf) - dinv);
    tf = df / lf;
    // }//THEN GOSUB 1520: GOTO 1505
    t=ta+ti+tf;
    if (lf < li) {
    double templf = lf; lf = li; li = templf;
    double tempdf = df; df = di; di = tempdf;
    double tempTF = tf; tf = ti; ti = tempTF;
    if (newT > t){
    di = (newT - l * dinv - df * ((1 / lf) - dinv)) / ((1 / li) - dinv);
    ti = di / li;
    }
    } else{ df = (newT - l * dinv - di * ((1 / li) - dinv)) / ((1 / lf) - dinv);
    tf = df / lf;}
    double templf = lf; lf = li; li = templf;
    double tempdf = df; df = di; di = tempdf;
    double tempTF = tf; tf = ti; ti = tempTF;
    }}
    df = (newT - l * dinv - di * ((1 / li) - dinv)) / ((1 / lf) - dinv);
    tf = df / lf;
    t=ta+ti+tf;

  2. #2
    sehudson's Avatar
    sehudson is offline Senior Member
    Join Date
    Mar 2010
    Posts
    340
    Rep Power
    5

    Default Re: illegal start of an expression!!

    Please wrap your code in tags to make it easier to read.
    Also, is this code inside of a class declaration, for example:

    Java Code:
    public class Example {
    
    //code here
    
    }

  3. #3
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,019
    Blog Entries
    7
    Rep Power
    20

    Default Re: illegal start of an expression!!

    Quote Originally Posted by gbonecapone View Post
    if (newT > t) && (lf > li) ERROR HERE unexpected type. required class. found value.<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    The syntax is if ( ... )

    Check your parentheses, you wrote if ( ... ) && ( ... )

    You probably wanted to write if (newT > t && lf > li)

    b.t.w. those are terrible variable names ...

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  4. #4
    gbonecapone is offline Member
    Join Date
    May 2013
    Posts
    68
    Blog Entries
    1
    Rep Power
    0

    Default Re: illegal start of an expression!!

    parentheses worked! thanks and haha yeah i know they are. im converting a program from basic and am just using the same variables names for ease of following the code. planning on changing them in the future. thanks for all the help youve been giving me.

Similar Threads

  1. Illegal start of expression
    By Robster in forum New To Java
    Replies: 3
    Last Post: 11-26-2011, 07:43 AM
  2. Illegal start of expression
    By lodaSchitt in forum New To Java
    Replies: 2
    Last Post: 04-28-2011, 10:04 PM
  3. Need help with illegal start of expression
    By WhopperMan in forum New To Java
    Replies: 4
    Last Post: 10-10-2010, 02:58 AM
  4. Illegal Start of expression
    By Macca07 in forum New To Java
    Replies: 3
    Last Post: 11-23-2009, 08:43 AM
  5. Illegal Start of an Expression
    By ddatta8 in forum New To Java
    Replies: 3
    Last Post: 12-20-2008, 08:40 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •