0% found this document useful (0 votes)
22 views7 pages

Java

The document provides an overview of Java, an object-oriented programming language developed by SUN Microsystems in 1991. It covers key concepts of object-oriented programming such as classes, objects, inheritance, polymorphism, and encapsulation, as well as the features and environment of Java. Additionally, it includes a simple Java program example and explains the significance of the main method and Java keywords.

Uploaded by

serieshub436
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views7 pages

Java

The document provides an overview of Java, an object-oriented programming language developed by SUN Microsystems in 1991. It covers key concepts of object-oriented programming such as classes, objects, inheritance, polymorphism, and encapsulation, as well as the features and environment of Java. Additionally, it includes a simple Java program example and explains the significance of the main method and Java keywords.

Uploaded by

serieshub436
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

COMPUTER BY : YATENDRA NIGAM SIR

JAVA :
Introduction :
Since the invention of the computer, many programming approaches have
been tried.
These include techniques such as modular programming, top-down
programming, bottom-up programming and structured programming.
The primary motivation in each case has been the concern to handle the
increasing complexity of programs that are reliable and maintainable.
These techniques became popular among programmers over the last
decades.

Object -oriented programming (OOP) is an approach to program


organisation and development, which attempts to eliminate some of the
pitfalls of conventional programming methods.

Basic concepts of object-oriented programming :


The general concepts of OOP which from the heart of JAVA language.

Objects and Classes :


Objects are the basic runtime entities in an object-oriented system.
They may represent a person, a place, a bank account, a table of data or
any item that the program may handle.
They may also represent user-defined data types such as vectors and lists.
The entire set of data and code of an object can be made a user-defined
data type using the concept of a ‘Class’.
A CLASS may be thought of as a datatype and an object as a ‘variable’ of
that data type.
Once a CLASS has been defined , we can create any number of objects
belonging to that CLASS.
A CLASS is thus a collection of objects of similar type.
Classes are user-defined data types and behave like the built-in types of a
programming language.
For example : the syntax used to create an object is no different than the
syntax used to create an integer object in C.
If ‘fruit’ has been defined as a class, then the statement
Fruit mango*
Will create an object ‘mango’ belongings to the class ‘fruit’.

Data Abstraction and Encapsulation :


The wrapping up of data and methods into a single unit (called class) is
known as encapsulation.

Abstaction refers to the act of representing essential features without


including the background details or explanations.

Inheritance :
Inheritance is the process by which objects of one class acquire the
properties of objects of another class.

Polymorphism :
Polymorphism is another important concept.
Polymorphism means the ability to take more than one form.

Applications of OOP :
1. Real time systems
2. Simulation and Modeling
3. Object oriented databases
4. Hypertext, Hypermedia and AI expert systems
5. CAD/CAM system

JAVA History :
Java is a general-purpose, object-oriented programming language
developed by SUN Microsystems of USA in 1991.
Originally called OAK by James Gosling.
Java was designed for the development of software for consumer
electronic devices like TVs, Toasters, such other electronic machines.

JAVA features :
Complied and Interpreted
Platform independent and portable
Object oriented
Robust and secure
Distributed
Familiar, Simple and small
High performance
Platform independent and portable ;
The most significant contribution of JAVA over other language is its
portability.
JAVA programs can be easily moved from one computer system to another,
anywhere and anytime.
Changes and upgrades in operating systems, procedures and system
resources will not force any changes in JAVA programs.
This is the reason why JAVA has become a popular language for
programming on Internet which interconnects different kinds of systems
worldwide.

Object-Oriented :
Java is a true object-oriented language. Almost everything in JAVA is an
object. ALL program code and data reside within objects and classes.
The object model in Java is simple and easy to extend.

Java Environment :
Java environments include many development tools.
The development tools are part of the system known as Java Development
Kit (JDK).

Java Development Kit :


Applet viewer (for viewing java applets)
Javac (java compiler)
Java (java interpreter)
Jdb (java debugger)
Overview of Java Language :
Java is a general-purpose, object-oriented programming language .
We can develop two types of java programs:

• Stand-alone applications
• Web applets

Simple Java Program :


Class SampleOne

Public static void main (string args [ ] )

[Link](“java is better than c++”);

}
}

Class declaration :
Class SampleOne, everything must be inside a class. Everything must be
placed inside a class.

Opening brace :
Every class definition in Java begins with an opening brace “{” and end with
matching closing brace “}” .

The main Line :


Public static void main (String args [] )

Defines a method named ‘main’.


Java program must include the main() method.
This is the starting point for the interpreter to begin the execution of the
program.
A java application can have any number of classes but only one of them
must include a ’main’ method to initiate the execution. (Note : JAVA applets
will not use the ‘main’ method at all)

Public : the keyword ‘public’ is an access specifier that declares the ‘main’
method as unprotected and therefore making it accessible to all other
classes.

Static : this declares this method as one that belongs to the entire class
and not a part of any objects of the class. The ‘main’ must always be
declared as ‘static’.
Void : the type of modifier ‘void’ states that the main method does not
return any value (but simply prints some text to the screen).

The output line :


[Link] (“Java is better than C++”) ;
The ‘println’ method is a member of the ‘out’ object, which is a static data
member of ‘System” class.

Java keyword :
Java language has reserved 50 words as keywords. We cannot use them as
names for variables, classes, methods and so on.

You might also like