vendredi 20 février 2015

Is the new keyword not executable?



In java how come at the top of the class we can initalize memory like so



public Class blahh{

private String s = new String("Hi");

public static void main(String args[]){}
}


Why is this legal, is not new key word executable code?


What if I replaced the private String s.... with a method call instead. Would it get executed?




Aucun commentaire:

Enregistrer un commentaire