Stubs and Skeletons

Stubs and Skeletons
In the distributed computing environment, stub stands for a client side object participating in the distributed object communication and a skeleton stands for a server side object participating in distributed object communication.  Stub  Skeleton  The stub acts as a gateway for client side objects and all outgoing requests to server side objects that are routed through it. The stub wraps ...

Overloading and Overriding

 S.No.    Overloaded Methods  Overridden Methods  1.  Arguments  Must Change  Must not change  2.  Return Type  Can change  Can’t change except for covariant returns  3.  Exceptions  Can change  Can reduce or eliminate. Must not throw new or broader checked exception  4.  Access Modifiers  Can change  Must not make more restrictive (can be less restrictive)  5. ...

OOPs concepts 1

OOPs concepts
Object-oriented programming (OOP) is a programming paradigm that represents concepts as “objects” that have data fields (attributes that describe the object) and associated procedures known as methods.   What is an Object? An object can be considered a “thing” that can perform a set of related activities. The set of activities that the object performs ...

Null Keys or values in HashMap/Hashtable 4

Can java.util.HashMap store null key/value pair? Yes it can, However only one null key is allowed, but can store many null values against non-null keys   Example public class HashMapTest { public static void main(String args[]) { HashMap h = new HashMap(); h.put(null,null); h.put(null, "1"); h.put("1", null); h.put("1", "1"); h.put("2", null); System.out.println(h.get(null).toString()); System.out.println(h.get("1")); System.out.println(h.get("2")); } ...

NoClassDefFoundError and ClassNotFoundException

NoClassDefFoundError and ClassNotFoundException
NoClassDefFoundError is an Error ,occurs when the source  was successfully compiled but at runtime, the required class files were not found. It may also arise when the class is already loaded in different classloader(usually a parent classloader would have loaded the class and hence the class cannot be loaded again) or if an incompatible class definition ...

Marker Interfaces

Marker interfaces are those which do not declare any required methods, but signify their compatibility with certain operations. The java.io.Serializable interface and Cloneable are typical marker interfaces. These do not contain any methods, but classes must implement this interface in order to be serialized and de-serialized.

JVM, JRE, JDK 2

JVM (Java Virtual Machine) is an abstract machine.It is a specification that  provides runtime environment in which java bytecode can be executed. JVMs are available for many hardware and software platforms (i.e. JVM is plateform dependent).   The JVM performs four main tasks: Loads code Verifies code Executes code Provides runtime environment   JRE is an acronym for ...

Error and Exceptions

Error and Exceptions
An Error is a subclass of Throwable that indicates serious problems that a reasonable application should not try to catch. Most such errors are abnormal conditions. An Error is represented by an object of class Error. But an error is too severe for a program to handle mostly abnormal conditions, the program must stop running. Example : ...

equals() method

When you really need to know if two references are identical, use ==. But when you need to know if the objects themselves (not the references) are equal, use the equals() method(which you may need to override).Comparing two object references using the == operator evaluates to true only when both references refer to the same ...

Dynamic and Static binding

Dynamic binding means the runtime finds the type of an object (probably from its Class<T> object) and uses that type to look for the types of methods invoked. It applies to overridden class members. And the only kind of class member you can override is an instance method.   Static binding means the compiler finds the type of ...