Thanks Marcel, Your code worked,but please clear,whats the differnece between abc c; c=(abc)b; & abc c = (abc)b; why does it not identify c if its declare before? [ June 07, 2002: Message edited by: Ghazala Islam ]
in java a class can declare static and non static memebers they can be variables, methods, blocks and classes and also interface(static by default). so any statement that has assignment may come on declaring variables like class xyz { int a = amethod(); public int amethod(){ return 10; } } so in your code if you write it using instance initialization block it will work perfectly like [QB]class chkconversion { class abc { int k=9; } abc a = new abc(),c ; Object b = a; { c = (abc) b; //compile ok } } [ June 09, 2002: Message edited by: awais syed ] [ June 09, 2002: Message edited by: awais syed ]