Posts

Showing posts from November, 2017

Reflection in java

Reflection:-         Reflection is the way to recognize any class at the runtime even if their name is found at runtime. If at the development time the class name is not known by the developer then we cann't use that class without reflection.        The use of class can be load that class, to create the object of that class, invocation of the methods. By Reflection the details of the class can also be obtained such as list of their methods, list of constructors, list of the fields, name of parent class and list of implemented interfaces. Note:- Reflection is meta data of class.         According to the Reflection each and every class and members of that class represented by the objects these objects are known as the reflected object or meta object.         Through the reflection in any java program we can obtained the meta data. java.lang.Class:-                 This is a class, In the heap area a  separate object of Class class always be created for the each loaded cla

constructor and constructor myths

Constructor :-               In java programming language all the no static variables that are defined in the class are known as instance variable of the class and in java every thing is represented as an object so that when a user creates a class want to use the functions and properties of that class then that person should have to creates a object of that class. Now the constructor must be used to create the object of the class. The main functioning of the constructor is to provide the Reference ID of the constructor generated by JVM. Some Basic Rules to declare the constructor:- 1. constructor name should be same as the class name. 2. constructor return type does not specified by the programmer. Syntax with example:-     class ABC      {             ABC()             {             }      } constructor type:- 1. default 2. parameterized 1. default:-            constructor with the empty parameter list is called a default constructor. 2. parameterized:-