Object-Oriented Programming in Java


Object-oriented programming in Java is special in few places. First, comparing to C++, Java has a new language construct: interface. Then, there is also primitive type wrapping (autoboxing, see below) which prepares objects representing primitive data like int (converted to Integer) or double (Double).
Wrapper classes have several additional methods which can be used when working with them. Also they are required when you want to store primitive data inside JDK-provided containers. Java also allows you to create anonymous classes basing on interfaces or classes, these classes are declared and created just in one place - place of definition. Another special case is Enum type which is a singleton class factory which can be used to assign attributes to enumeration values or to define a thread-safe singleton class. Each Java class can implement "main" static method which makes it runnable using for example "java" command. One of the most widely used standard for Java objects is JavaBeans which primary aim was to deliver reusable component framework.


Specific resources


  • "Java in a Nutshell - Chapter 3: Object-Oriented Programming in Java" book by David Flanagan

See also