JAVA Simple Tutorial
JAVA Simple Tutorial
JAVA Simple Tutorial
Introduction
Java is an object-oriented programming language developed by Sun Microsystems and released in 1995. Modeled after C++, the Java language was designed to be small, simple, and portable across platforms and operating systems, at both the source and binary level. One of the resons for Java’s popularity is its ability to bring executable content to the web.Java has only the necessary functionality needed to implement its feature set. It has omitted the features of C and C++ which have been considered to be “unsafe” pointer “forging” operator overloading static objects Memory is managed automatically, relieving the programmer from being responsible for freeing unused space There is no Java preprocessor – the program that you see is the same program that the Java compiler sees.
Let The Games Begin…
CONCEPTS OF OOPS
As you know all computer programs consist of two elements: code and data.
Furthermore, a program can be conceptually organized around its code or around its data. That is some programs are written around “‘what is happening” and other are written around “who is being affected”. These are two paradigms that govern how a program is constructed. The first way is called process oriented model. This approach characterizes a program as a series of linear steps. The process oriented model can be thought of as code acting on data. Procedural languages such as C employ this model to considerable success. To manage increasing complexity the second approach called object oriented programming was conceived. Object oriented programming organizes a program around its data( that is its object) and a set of well defined interfaces to that data. An object oriented program can be characterized as data controlling access to code.
CLASSES
The importance of object-oriented programming is that it enables programmers to organize their programs in ways that resemble the organization of objects in the real world, which makes programming easier and more logical. Using object- oriented programming, the overall programs are made up of many different components (called “objects”), each of which has a specific role in a program and can talk to the other components in predefined ways.Classes are called as a template or they can be called as a prescription of an object.
Without class no object can exist and every object has a class.
OBJECTS
Every thing in this world is called an object. An object is created by the method and data in the class.
METHODS
Methods are nothing but functions. In procedural languages these are called functions. In OOP they are called method. It is a function that can be used by the object or an object can be created by the method.
PIE FEATURES OF OOPS
There are three main principals of oops which are called Polymorphism, Inheritance and Encapsulation.
ENCAPSULATION
Encapsulation is a mechanism that binds together code and data it manipulates, and keeps both safe from outside interface and misuse. One way to think about encapsulation is as a protective wrapper that prevents code and data from being arbitrarily accessed by other code defined outside the wrapper.
INHERITANCE
Inheritance is the process by which one object acquires the properties of another object.
This is important because it supports the concept of hierarchical classification. Most knowledge is made by hierarchical classification.
POLYMORPHISM
It is a feature that allows one interface to be used for general class of actions. The specific action is determined by the exact nature of the situation. More generally the concept of polymorphism is often expressed by the phrase “one interface, multiple methods”.
WHAT IS JAVA?
Java is an object oriented programming language. Java is an enhanced form of C++. From C java drives its syntax. Many of java’s object oriented features are influenced by C++. Java is platform independent. It can run on any platform. Java has a compiler and an interpreter.
Its compiler generates intermediate code which is the further interpreted by its interpreter.