Java is a fun language. Some of the reasons to use it are: Built-in support for multi-threading, socket communication, and memory management (automatic garbage collection). Object Oriented (OO). Better portability than other languages across operating systems. Supports Web based applications (Applet, Servlet, and JSP), distributed applications (sockets, RMI, EJB etc) and network protocols (HTTP, JRMP […]
this() is used to invoke a constructor of the same class. super() is used to invoke a superclass constructor.
Two methods may not have the same name and argument list but different return types.
By value but in the case of objects, the value is a reference.
Use the super keyword like so: super.someMethodCall(“some string parameter” ); Note that in most cases the super keyword may be omitted.
A call to the default super class constructor is implicitly the first line of each constructor unless a different constructor is explicitly provided by the developer. So for the first line of a constructor that calls a non-default super class constructor, one might write: super(“some string”); It’s a compilation error if it is not the […]
extends is the keyword used to declare that this class is a subclass of the class that follows the extends keyword. Implements is a keyword that designates this class as an implementer of the specified interface.
An abstract class is a class declared with the abstract keyword. Although references to such a class may be used, the class may not be directly instantiated. Abstract classes may define methods or just declare them and may contain variables.
1. static nested class 2. inner (non-static) nested class 3. local class 4. anonymous class A static nested class is just like a normal Java class. If it is public, it can be accessed or used to create objects just like any other class. A non-static inner class requires an object of the containing class. […]
Making a class final adds some security and consistency to the class behaviour. E.g. by making the String class final, you cannot override its length method. The compiler may optimize the code and make it run faster when a class is declared final.