1) Instance variables will be initialized to default values if it is not set during the creation of an object. This might seem like a useless reminder but it's amazing the number of programmers who forget about this.
2) The for loop will allow java to access variables instantly (as of Java SE 6).
For example, instead of writing
int x = 0;
for ( x =0; x
MyObject ob = new MyObject();
-- ob in this case will automatically call on to the toString method for MyObject. If that is not found, it will find the super() method, which in this case will be the Object's toString() method as every class directly inherits the Object Class.
No comments:
Post a Comment