Introduction to Java
We have already learned a few computer-programming languages, like Logo, C++, and Visual Basic. Java is also a very popular computer programming language. Like Visual Basic, it is an object-oriented language. It originated from the programming language, Oak. Oak had some limitations and hence, was modified, giving rise to a new language, which could run on all the computers, networks and operating systems. This new version of Oak in 1996, was given the name, Java.
Java is used as a language for creating Internet-based applications. It creates small application modules, which can be embedded into web pages. These modules are called Applets, which make it possible for a user to interact with the web pages. It has a coding syntax very much similar to C++.
CHARACTERISTICS OF JAVA
- Java is an object-oriented programming language providing features such as inheritance, polymorphism, and abstraction.
- Java programs can access data from local machines as well as the web. Java is easy to write, read and use.
- Java programs can be executed on any platform that has a Java-enabled Internet browser.
- Java supports the ability of an application to perform multiple tasks at the same time. This ability is also termed as multithreading.
OBJECT ORIENTED PROGRAMMING
Object-oriented programming is one of the most effective ways of programming in computers. It eliminates most of the drawbacks of procedure-oriented programming used in basic, C, etc, by incorporating new concepts. It is an of separating the program into a number of objects (self-contained application components that work together to accomplish a task). In object-oriented programming, a problem is not perceived as a sequence of various steps but as a collection of different objects.
What is an Object? Objects are real-world entities or items. They can be either non-living entities, such as a chair, sketch-pen, car or a pair of goggles or living entities, such as fish, flowers, dogs or a human. In other words, an object may represent a person, an employee, an exam or a geometry box.
Let us understand some more terms related to object-oriented programming (OOP)
CLASS: A class is a collection of similar objects. It represents a group of objects of the same kind. For example, Motor Vehicles. A scooter, bike, bus, and truck fall under the category of motor vehicles. They all belong to the same class.
ENCAPSULATION: The wrapping up of data and ümctions in an object or class is called Encapsulation.
DATA HIDING: By data hiding, it is made inaccessible for other functions outside the objects.
DATA ABSTRACTION: The act of showing essential features of the objects without giving details is termed as, Data abstraction.
INHERITANCE: An object of one class can inherit the properties of another class by a process called inheritance.