why the following code throws error on compliation
public class Numeric
{
public static void main(
String[] args)
{
int i = 3;
//line 1
if(i==3)
//line 2
int p = 3;
}
}
whereas after inserting curly braces in line 1& 2 respectively(the following code) it gets compiled without any problem
public class Numeric
{
public static void main(String[] args)
{
int i = 3;
if(i==3)
{
int p = 3;
}
}
}
similar is the problem with the ques on "while loop mystery" in this forum.
Please help!
Lusha