vendredi 31 juillet 2015

System.out is declared as static final and initialized with null?

When I was going through the System.class I found something which seemed strange to me. When you look at declaration of System.in, System.out, System.err these are decalred as final static but also initialized with null

public final static InputStream in = null;  
public final static PrintStream out = null;  
public final static PrintStream err = null;

Since final can be initialized only once then how these are getting managed ?
When we use System.out.print("..."); It is obvious that out is not null but being a final static how it is not null ?

So can any one explain that how out is initialized which is already declared final ?





Aucun commentaire:

Enregistrer un commentaire