-
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
}
}
-
You should use brackets to organize your if statements:
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.
-
i was about to write the statement, but i was surprised to see that error, thanks a lot
-