What will be the output
I have a confusion in java....primitive variables are instantiated during decleration.....? ... if yes than .....what will be out put of following pseudocode
class A {
// variable decleration
final int i;
}
public static void main( String []a){
System.out.println( "value of i is "+ new A().i );
}
dont u thgink it should give run time error...
[401 byte] By [
mayaaaa] at [2007-11-27 11:24:44]

it should print 0, as in class scope all primitives are initialised with 0 (or equivalent value)
in other method or block scope though, primitives are not initialised standardly
public void testMethod() {
int i;
System.out.println("value of i: " + i);
}
shouldnt even compile (message: "Variable 'i' might not have been initialized")
> > ok ...thanks yaar
>
> It's not Talk Like A Pirate Day already, is
> it? I thought that was September 19...
>
> ~
Surely you don't have to wait for pirate day to talk like a pirate..... its a right which should be exploited at everytime chance matey.
Avast!!