Junilu Lacar wrote:Your statements about casting to Test and about wierdness indicate that you don't fully understand how casting works.
A cast does not change an object's type. A cast is merely a reassurance to the compiler that the thing you are casting is indeed compatible to the type that you're casting it to. It's like you guaranteeing to a creditor that your friend can indeed pay his loan off. The cast basically tells the compiler, "Trust me on this, I know you only know that this other thing is an Object but I've checked it out and can assure you it's actually an instance of Test."
Beware of getting tangled in the weeds before you even have a chance to survey the general lay of the land around you.
My understanding :Buffered input streams read data from buffer, the native input API is called only when the buffer is empty. Similarly, buffered output streams write data to a buffer, and the native output API is called only when the buffer is full. Even though there is no need to flush on each iteration, if we still do it that adds some extra overhead at each iteration and hence slowing down the code execution .