In the Greeter example, the call to println implicitly calls toString on the current object. Once that’s done, initialization proceeds down the object’s class hierarchy, filling in the properties of each class in order. When you create a new object, its topmost superclass is initialized first. The problem exists there too, and it has to do with the order that classes and their properties are initialized. This might be the most counterintuitive of the three issues, but it’s probably also the most familiar to anyone who’s worked with Java. In reality, it throws a NullPointerException.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |