This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I am learning java, and studying the following example from sun.com.
I am having question regarding the ReadInfo.java. In specific, I do not know how to understand the code of line UserInfo user1 = (UserInfo) ois.readObject(); Especially, what is the functionality of “UserInfo” in the parenthesis. What is the relationship between (UserInfo) and ols.readObject( ).
the method is defined to return an Object reference. That means it can return ANY object. We're telling the compiler that we really know it is returning a UserInfo reference, so we're sort of forcing it to consider it as such.
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors