You should delete the obviously misplaced ; and finish all your opened brackets. Try this:
public class Basic
{
public static void main (String []args)
{
int first = 1;
if (first == 1)
{
System.out.println("I did it");
}
else
{
System.out.println("I didnt do it");
}
}
}
If you have problems with brackets, you can configure Eclipse to automatically put closed bracket under each other like in the example.
The semicolon you have placed there ended your if statement, so it had no effect on the code between the brackets. You can imagine (Java purists will pardon the simple explanation), that after if, there is only one command or command block allowed. The brackets will group more commands to one block.
Try this example, it will explain you how it works.
int i=1;
if (i==1)
System.out.println("I should be here when i==1");
else
System.out.println("Will this output be printed out? No, this is else section!");
if (i==2)
{
System.out.println("I should be here when i==2");
System.out.println("Will this output be printed out? No! Condition was not met, because i==1 and we are in the block");
}
if (i==2)
System.out.println("I should be here when i==2");
System.out.println("Will this output be printed out? Yes, because the commands are not in the block!");
if (i==2); //WATCH OUT, there is semicolon that terminated if statement
System.out.println("Will this output be printed out? Yes, because that semicolon has terminated the if statement!");
(1 + 2 (3+4make any sense?