Swing Component in java

Swing Component in java 
java programming and c, c++, Matlab, Python, HTML, CSS programming language, and new techniques news and any history.

Reflection API

Reflection means an ability of a software to analyze itself. In Java, Reflection API provides a facility to analyze and change the runtime behavior of a Class, at runtime.
Reflection API








For example, using reflection at the runtime you can determine what method, field, constructor or modifiers a class supports.

What is reflect package?

java.lang.reflect package encapsulates several important interfaces and classes. These classes and interface define methods which are used for reflection.

Some Important Classes of java.lang.reflect package

Class,
Class, does?
Arrayallow you to dynamically create and manipulate arrays
Constructorgives information about constructor of a class
Fieldprovide information about field
Ma methodprovides information about a method
the Modifierprovide information about a class the nd member access modifier
Proxysupports dynamic proxy classes
Apart from these classes java.lang.Class is another very important class used in Reflection API.

Uses of Reflection

  • Developing IDE
  • Debugging and Test tools
  • Loading drivers and providing dynamic information

Disadvantages of Reflection

  • Low performance
  • Security risk
  • Violation of Oops concept

Legacy Classes

An early version of Java did not include the Collection framework. It only defined several classes and interface that provide a method for storing objects. When Collection framework was added in J2SE 1.2, the original classes were re-engineered to support the collection interface. These classes are also known as Legacy classes. All legacy classes and interface were redesigns by JDK 5 to support Generics.
The following are the legacy classes defined by java.util package
  1. Dictionary
  2. HashTable
  3. Properties
  4. Stack
  5. Vector
There is only one legacy interface called Enumeration
NOTE: All the legacy classes are syncronized

Enumeration interface

  1. Enumeration interface defines a method to enumerate through a collection of object.
  2. This interface is suspended by Iterator interface.
  3. However, some legacy classes such as Vector and Properties defines several methods in which Enumeration interface is used.
  4. It specifies the following two methods
























































Comments