Showing posts with label Learn Java. Show all posts
Showing posts with label Learn Java. Show all posts

March 20, 2014

The following piece of code describes how to silently and properly close a stream resource in Java:
File f = new File("SomeFile.txt");
FileOutputStream fos = null;
When an object becomes unreachable, it is flagged as collected by the garbage collector. If it has a finalize() method, it is marked for finalization and put in a finalization queue. After finalization, it becomes finalized. If it does not have a finalize() method, it is directly marked as finalized without being inserted in the finalization queue.
This quick reminder about pros and cons of Java abstract classes and interfaces:


Interface
  • A class can implement multiple interfaces
  • An interface cannot provide any code at all

February 13, 2014

A high-level programming language developed by Sun Microsystems. Java was originally called OAK, and was designed for handheld devices and set-top boxes. Oak was unsuccessful so in 1995 Sun changed the name to Java and modified the language to take advantage of the burgeoning World Wide Web.


Java is an object-oriented language similar to C++, but simplified to eliminate language features that cause common programming errors.