See the following example code:
public class IllegalStartOfExpression
{
public void methodA()
{
System.out.println("This is method A");
/* methodB is defined inside methodA because we didn’t close methodA before defining methodB*/
public void methodB()
{
System.out.println("This is method B");
}
}
}
Now see the solution:
public class IllegalStartOfExpression
{
public void methodA()
{
System.out.println("This is method A");
}
/* methodA is finished then, methodB is being defined*/
public void methodB()
{
System.out.println("This is method B");
}
}
0 comments:
Post a Comment