This document provides an overview of the basics of Java. It discusses that Java is an object-oriented programming language derived from C and C++. It was originally developed by Sun Microsystems in 1991 under the name Oak but was renamed to Java in 1995. The document outlines the history and development of Java, and describes how Java programs can create both applications and applets. It also summarizes some of the key differences between Java and C++. Finally, it provides a high-level overview of the main features of Java including being simple, object-oriented, platform independent, secure, robust, architecture neutral, portable, dynamic, interpreted, high performance, multi-threaded, and distributed.
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
2. Basics of Java
1. Basics of JavaBasics of Java
By
Nilesh Dalvi
Lecturer, Patkar-Varde College.Lecturer, Patkar-Varde College.
http://www.slideshare.net/nileshdalvi01
Java and Data StructuresJava and Data Structures
2. Introduction
• Java is a object-oriented programming
language.
• Related to C++, which is an offspring of
C-Language.
• Much of the characteristics of Java
inherited from C-Language & C++.
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
C-Language C++
Java
Syntax Oops features
3. History of Java
• General purpose object-oriented language
developed by sun microsystems in 1991.
• It is initially called ‘oak’, was
renamed as ‘Java’ in 1995.
• Originally designed to develop software
for consumers electronic devices like
toasters, TVs, etc.
• First language that is not tied to any
particular H/W or OS
• Java is platform-neutral language.
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
4. Java applets and Application
• Used to create two types of programs:
Applications and Applets.
• Application: program that runs on your
computer, under the os of that computer.
• Applet: application designed to be
transmitted over the internet and executed
by a Java-compatible web browser.
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
5. Difference between C++ and Java
• Java does not support operator overloading
• Java does not have template classes as in C++.
• Java does not support multiple inheritance of classes.
Accomplished by “interfaces”
• Java does not support global variables, every variable &
method is declared within a class.
• Java does not use pointers.
• Java has replaced destructor function with a finalize()
method.
• There are no header files in java.
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
6. Java Features
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
Simpl
e
Object-
Oriented
Platform-independent
Secured
Robust
Architecture-neutral
Portable
Dynamic
Interpreted
High Performance
Multi-threaded
Distributed
7. Java Features
Simple:
• According to Sun, Java is simple because:
– Syntax is based on C and C++ (so easier for
programmers to learn it after C++).
– Removed many confusing and/or rarely-used features
e.g., explicit pointers, operator overloading etc.
– No need to remove unreferenced objects because there
is Automatic Garbage Collection in java.
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
8. Java Features
Object-Oriented:
• Object-oriented programming(OOPs) is a methodology
that simplify software development and maintenance by
providing some rules.
• Basic concepts of OOPs are:
– Classes and Objects
– Inheritance
– Polymorphism
– Abstraction
– Encapsulation
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
9. Java Features
Platform-independent
• A platform is the hardware or software environment in
which a programs runs.
• Java platforms has to components
– JVM (Java Virtual Machine)
– Java application programming Interface(API)
• Java programs can be easily moved from one computer
system to another, any where any time, changes in OS,
processors and system resources will not force any changes
in java programs.
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
11. Java Features
Secure:
• With java secure features it enable us to develop virus free,
temper free system.
• Java program always runs in Java runtime environment
with almost null interaction with system OS, hence it is
more secure.
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
12. Java Features
Robust:
• Robust simply means strong.
– Java uses strong memory management.
– There are lack of pointers that avoids security problem.
– There is automatic garbage collection in java.
– There is exception handling and type checking mechanism in java.
• All these points makes java robust.
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
13. Java Features
Architecture-neutral :
• There is no implementation dependent features
• e.g. size of primitive types is set.
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
14. Java Features
Portable :
• Java byte code can be carried to any platform.
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
15. Java Features
High -Performance:
• Java enables performance with the use of just-in-
time compiler.
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
16. Java Features
Distributed:
• Java is designed as a distributed language for creating
applications on networks.
• It has ability to share both data and programs.
• This enables multiple programmers at multiple remote
locations to collaborate and work together on a single
project.
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
17. Java Features
Multi-threaded:
• A thread is like a separate program, executing
concurrently.
• We can write Java programs that deal with many tasks at
once by defining multiple threads.
• This means that we need not wait for the application to
finish one task before beginning another.
• The main advantage of multi-threading is that it shares the
same memory.
• Threads are important for multi-media, Web applications
etc.
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
18. Java Features
Dynamic:
• Java is a dynamic language.
• Java is capable of dynamically linking in new class libraries,
methods and objects.
• Java programs supports functions written in other
languages such as C and C++. These functions are known as
native methods.
• Native methods are linked dynamically at runtime.
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
19. Java Features
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
SimplSimpl
ee
Object-Object-
OrientedOriented
Platform-independentPlatform-independent
SecuredSecured
RobustRobust
Architecture-neutralArchitecture-neutral
PortablePortable
DynamicDynamic
InterpretedInterpreted
High PerformanceHigh Performance
Multi-threadedMulti-threaded
DistributedDistributed
20. Java Development Kit
JDK contains a collections of tools that are used for developing and running
Java programs
javac (java compiler) – converts source code into java bytecode.
java (java interpreter) – An interpreter interpret the class files generated by
the javac compiler.
jar (archiver) - which packages related class libraries into a single jar file.
javadoc - documentation generator, which automatically generates
documentation from source code comments (HTML format)
jdb (debugger)- Helps to finds errors in our programs
javap (disassember) – enables to convert byte code files into a program
source code.
appletviewer – This tool can be used to run and debug java aaplets without
a web browser.
javah – Produces header files for use with native methods.
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).