A Report On Java Oop Computer Science Essay

Published: Last Edited:

This essay has been submitted by a student. This is not an example of the work written by our professional essay writers.

Java Compiler does also same thing. Java Compiler Produces an INTERMEDIATE CODE called BYTE CODE for its own Machine called JVM


Then After this Byte Code is given to the JAVA Interpreter which will convert this code to machine Language When java source code is compiled, each individual class is put into its own output file named after the class and using the .class extension.

This is why it is good idea to give your java source file the same name as the class they contain—the name of the source file will match the name of the .class file. When you execute java program, you are actually specifying the name of the class that you want to execute. It will Automatically search for the file by that name that has .class extension. If it finds the file, it will execute the code The code contained in the specified class. Polymorphism plays an important role in allowing objects having different internal structure to share the same external interface. This means that a general class of operations may be accessed in the same manner even though specific actions associated with each operation may differ. Polymorphism is extensively used in implementing inheritance. Polymorphism is another important OOP Concept. An Operation may exhibit different behaviors in different instances. The behavior depends upon types of data used in the operation. For Example , consider the operation of addition. For two numbers, the operation will generate a sum. If the operands are strings, then the operation will produce a third string by concatenation. The process of making an operator to exhibit different behavior in different instance is known as operator overloading. As Shown in above fig the main class is shape and its method is used by three subclasses. But With different Parameters this is called as Polymorphism. Inheritance is the process by which object of one class acquires the Properties of another class. Inheritance is one of the most useful OOP (Object Oriented Programming) Concepts. It gives the reusability of code in very efficient way. Inheritance Supports the concept of hierarchical classification.

As Shown In Fig. The main class is University. This is inherited by two class :

1) Computer Department

2) Management Department

Both the department can use the properties of main class University. A Sub class can inherits all instance variables and methods from its super class and also may have its own methods and variables. To Inherits the class we have to add the EXTENDS keyword and The name of Super class after SUB CLASS Name. A class that is inherited is called SUPER CLASS. The class that inherits the Super class is called SUB CLASS

Multi level Inheritance contains as many layers of inheritance as one can like.

It is Possible to use a Sub class as a Super class of another class. This is called Multilevel Inheritance. As shown in left Fig We have classes called A,B and C. C be the sub class of B, which is a subclass of A. The wrapping up of data and function into a single unit is called as Data Encapsulation. Data encapsulation is the most striking feature of a class. The Data is not accessible to the outside world, and only those functions which are wrapped in the class can access it. This Functions provide the interface between the object's data and the program. This insulation of the data from direct access by the program called DATA HIDING OR INFORMATION HIDING.

Abstraction refers to the act of representing essential features without including the background details or Explanations. Classes use the concept of abstraction and are defined as a list of abstract attributes such as size, width and Cost, and functions to operate these attributes. They Encapsulate all the essential properties of the objects that are to be created. This attributes sometimes are called data members because they hold information. The Functions that operate on these data are sometimes called methods or member functions.

The modern approach to handling events is based on the delegation event model, which defines standard and consistent mechanisms to generate and process events. The delegation event model provides a standard mechanism for a source to generate and event and send it to a set of listeners. An Event is an object that describe a state change in source. It can be generated as a

Consequences of a person interacting with the elements in graphical user interface. Some of the activities that cause events to be generated are pressing a button, entering a character via keyboard, selecting an item in a list and clicking mouse.

A source is an object that generates an event. This occurs when the internal state of that object changes in some way. Sources may generate more than one type of event. A source must register listeners to receive the notifications about the specific type of event. Each type of event has its own registration method. Here is the General Form :

Public void addTypeListner(TypeListener el)

A listeners is an object that is notified when an event occurs. It has two major requirements.

1)It must have been registered with one or more sources to receive notifications about specific types of events.

2)It must implement methods to receive and process the notifications. The method that receive and process events are defined in a set of interfaces found in java.awt.event .