simple program to show local variables in if block
// simple program to show local variables in If block
package variables;
public class LocalVariableInBlock {
public static void main(String[] arg) {
int i;
if(arg.length>0) {
i=20;
}
else{ // here with out else we will get compile time error
i=40;
}
System.out.println(i); // valid
}
}
0 comments:
Post a Comment