Results 1 to 4 of 4

Thread: compiling error

  1. #1
    Adeline is offline Member
    Join Date
    Dec 2010
    Posts
    4
    Rep Power
    0

    Default compiling error

    I hope i've started this thread in the correct place.
    my error is Sytax error on token ")", Statement expected this token.i've readen another answer about this, on this forum but for me it's not a good one. so i atach my java code:

    import java.util.Scanner;
    import java.io.*;
    import java.lang.Object;

    public class markov {
    public void veriflambda(String cuvant)
    {
    int lung;
    lung=cuvant.length();
    if(cuvant.indexOf("@")>=0)
    if(lung>1) //this is where i have this problem

    }
    public static void main(String[] args){
    System.out.println("introduceti alfabetul: ");
    Scanner scan=new Scanner(System.in);
    String alfa;
    alfa=scan.next();
    String regdr[],regstg[];
    regdr = new String[100];
    regstg = new String[100];
    String cuvvid="",cuvinit;
    int n;
    System.out.println("Introduceti nr regulilor:");
    n=scan.nextInt();
    System.out.println("Introduceti regulile:");
    for(int i=0;i<n;i++)
    {
    System.out.print((i+1)+".");
    regstg[i]=scan.next();
    System.out.print("->");
    regdr[i]=scan.next();
    System.out.println();
    }
    String cuvvidinit="";
    System.out.println("Cititi cuvantul:");
    cuvinit=scan.next();
    int i=0;
    int poz;
    // the rest of the code is not important to show it here, if i'm wrong tell
    // me and i'll atach all of it
    }
    }

  2. #2
    KevinWorkman's Avatar
    KevinWorkman is online now Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,969
    Rep Power
    8

    Default

    You should use brackets to organize your if statements:
    Java Code:
    if(something){
       if(something else){
          //whatever
       }
    }
    But your problem is: what should happen if that if statement evaluates to true? You don't have a statement (or maybe a semicolon, I'm too lazy to check) there.

  3. #3
    Adeline is offline Member
    Join Date
    Dec 2010
    Posts
    4
    Rep Power
    0

    Default

    i was about to write the statement, but i was surprised to see that error, thanks a lot

  4. #4
    DarrylBurke's Avatar
    DarrylBurke is online now Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,305
    Rep Power
    20

Similar Threads

  1. Error while compiling
    By vibaviattigala in forum New To Java
    Replies: 3
    Last Post: 11-30-2010, 02:07 PM
  2. dos compiling error msg.
    By gatehrdy in forum New To Java
    Replies: 22
    Last Post: 09-01-2010, 12:06 AM
  3. Having error while compiling
    By Kodeee in forum New To Java
    Replies: 12
    Last Post: 03-17-2009, 11:08 AM
  4. Compiling error
    By lawksalih in forum New To Java
    Replies: 6
    Last Post: 01-29-2008, 07:26 PM
  5. Error while compiling
    By ai_2007 in forum Advanced Java
    Replies: 1
    Last Post: 07-01-2007, 11:37 AM

Posting Permissions

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