Core Java

Core Java
Course Material

Introduction:

Before the introduction of computer technology, electronic devices had a very high consumption rate. We have to run a microprocessor (which is located in the circuit) so we can operate an electronic device. To run the microprocessor requires a programming code. The ability to run a microprocessor has allowed computer technology to be evaluated in the marketplace. Requirement(s) play a key role in the software industry and therefore a first language (machine language) was created in order to develop applications (programs). However, application development using machine language has several disadvantages.

1) Complexity of code 2) Knowledge of the language is different

So, because of the 2 drawbacks previously mentioned; a new type of methodology called Procedure Oriented Methodology has been proposed by the Research & Development Centre.

Most programming languages have been built using this Procedure Oriented Methodology and examples include Fortan, Cobol, Pascal, C, etc. All programming languages created using this procedure-oriented approach face three significant disadvantages:

1) Data and code that operates on data are poorly organized; thus, preventing security from being implemented.

2) The degree of complexity makes it impossible to manage.

To address these two major disadvantages of procedure-oriented programming; object-oriented programming has been developed (by the Research & Development Centre) as an alternate method of programming.

There are four basic features of an object-oriented programming structure:

1. Encapsulation

2. Abstraction

3. Polymorphism

4. Inheritance

Encapsulation:

Encapsulation is defined as a way of combining both data and code and storing them together as one unit. Benefits of encapsulation include security.

Fig 1: Encapsulation Unit (Class)

Q: How can I perform encapsulation programmatically in Java?

A: You can provide encapsulation in Java by declaring the variables and functions of a class together using the class keyword.

Abstraction:

Abstraction is the process of presenting the necessary and hiding the unnecessary.

Note: Abstraction is the product of encapsulation.

Fig 2: Abstraction

Polymorphism:

When an object displays a variety of different behaviors in a variety of situations, that object is exhibiting polymorphism.

There are two types of polymorphism in Java: (1) Static and (2) Dynamic.

Static polymorphism (also known as method overloading) is determined at compile time while dynamic polymorphism (also known as method overriding) is determined at runtime.

Polymorphism determines whether static polymorphism (i.e., bound at compile time) is used versus dynamic (i.e., bound at run time) based on the type of binding used.

Binding - Where you link a specific method call to the specific method definition is called binding.

Static Polymorphism - Linking of the method call to the method definition at compile time is called static polymorphism (or early binding).

Dynamic Polymorphism - The linking of the method call to the actual method definition at run time is called dynamic polymorphism (or late binding).

Inheritance - Inheritance is when you inherit properties (or attributes) from a superclass into its subclasses.

Note: Inheritance allows for code reusability.

Now that we have discussed the features of Object-Oriented Programming (OOP), we will now discuss some of the major points of the usage of Java in the real-world environment.

Q: What is Java and why use it?

A: Java is an object-oriented programming language that allows the development of software and web applications. The creation of Java software is based on the object-oriented programming structure, providing security and ease of code complexity. Java is also capable of building dynamic Web pages. Another important feature of Java is that it is platform-independent.

Q: How Many Types of Javas?

A: There are three types of Java platforms:

1.       Java SE - Standard Edition

2.       Java EE - Enterprise Edition

3.       Java ME - Mobile/ Micro Edition

Q: What Is the Difference Between Platform Dependent and Platform Independent Programming Languages?

A: a) Platform Dependent Language - Platform-Dependent Languages are Based on a Procedure-Oriented Programming Methodology.

Platform: is defined as the environment in which an application is executed.

Ex: Cobol, Fortran, Pascal, and C.

For example, we take the c program assume that we have define 10 lines of code inside the c program. After compiling the program object file is generated. After executing the program .exe file is generated. Suppose this program is executed on the dual core processor that kind of processor instructions was loaded on the .exe file. Suppose we copy that file on another operating system means another processor say some xeloron processor. So, that .exe file was not executed there means that instructions what we have provided inside the .exe file does not match to this processor. So, this is called platform dependency. This is the main reason our procedure-oriented applications were not using in web application development.

b) Platform Independency Language - The languages which have been implemented on the basis of object-oriented approach is called platform independence applications.

Ex: Java, etc.…

Suppose we compile the java program with a java compiler it provides a class file. Class file means combination of byte code designed by ByteEngineeringLibrary(BEL). This class file we have to execute on java platform with the help of JVM (java virtual machine) provided by our jdk (java development kit) software released by sun networks.


<Previous                                                                                                     Next>

0 Ravula Kartheek:

Post a Comment