« first day (4487 days earlier)      last day (460 days later) » 

12:00 AM
Math is like love -- a simple idea but it can get complicated. -- R. Drabek (source)
 
You can serialize static fields if you list them in your writeObject() method, can't you? What about transient fields?
What do you need Externalizable for? You can perform your own custom serialization with Serializable too (thanks to the aforementioned methods)
 
 
2 hours later…
1:44 AM
What does UTF stand for in the writeUTF() method that serializes Strings?
Does it look like something that makes sense?
```
objectOutputStream.flush();
objectOutputStream.close();
```
`close()` automatically invokes `flush()`, doesn't it?
 
2:04 AM
 
 
2 hours later…
4:14 AM
One thing I don’t get about InputStreams and OutputStreams is this. Why do you need to cast those returned ints into bytes to get their real values? Aren’t those higher bits going to be zeros (as long as the byte capacity is not exceeded)?
 
 
2 hours later…
6:23 AM
What does it return? There's no such thing as Iterator, it's just an interface. What class does this object actually belong to?
 
 
2 hours later…
8:15 AM
What is the difference between, for example, T extends Number and ? extends Number?
 
 
5 hours later…
1:02 PM
How is having a public setter any better than just having a public field? Anyone can change its value anyway
 
 
2 hours later…
3:06 PM
@SergeyZolotarev Maybe there's a method in the Object class that could answer that question.
 
 
7 hours later…
9:58 PM
@SergeyZolotarev For most fields, you're absolutely right
A public getter and setter with no customisations is functionally identical to a public field
Half the idea behind getters and setters for everything, though, is to detach data from logic; meaning in the future, you could refactor and completely remove a field from a class, but delegate it via a backwards compatible setter
For fields with a custom setter, it's more obvious; you could have validation logic directly in the setter, in which case there are clear advantages to a setter
personally, I've started switching away from getters and setters. Unless they serve an explicit purpose, I consider them boilerplate
 

« first day (4487 days earlier)      last day (460 days later) »