Upload
jigarthacker
View
235
Download
0
Embed Size (px)
Citation preview
Page 3
Features of JAVA
Simple
Object-Oriented
Platform Independent
Secured
Robust
Architecture Neutral
Portable
High Performance
Distributed
Multi-threaded
Page 4
Simple
Java is a simple in the sense of :- Syntax based on 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 object because there is
Automatic Garbage Collection in JAVA.
Page 5
Object-Oriented
Object-Oriented means we organize our software as a
combination of different types of objects that incorporates
both data and behavior
Object-Oriented Programming (OOPs) is a methodology that
simplify software development and maintenance by providing
some rules
Basic concepts of OOPs are: Object
Class
Inheritance
Polymorphism
Abstraction
Encapsulation
Page 6
Platform Independent
A platform is a hardware or software environment in which a
program runs. There are two types of platforms software-based
platform. The java platforms differs from most other platforms
in the sense it’s a software-based platform that runs on top of
other hardware-based platforms. It has two components Runtime Environment
API(Application Programming Interface)
Page 7
Cont..
Java Code can be run on multiple Platforms e.g. Windows,
Linux, Sun Solaris , Mac OS etc. Java Code is Complied by the
compiler and converted into bytecode. This bytecode is a
platform independent code because it can be run on multiple
platforms.
Page 8
Secured
Java is secured because: No explicit pointer
Programs runs inside virtual machine sandbox.
Page 9
Robust
Robust Simply Means strong. Java uses strong memory
management.
There are lack of pointers that avoids security problem.
There is automatic garbage collection.
There is exception handing and type checking mechanism in
java. All these points makes java robust.
Page 12
High Performance
Java is faster than traditional interpretation since bytecode is
“Close” to native code still somewhat slower than a compiled
language (e.g. C++)
Page 13
Distributed
We can create distributed applications in java. RMI and EJB are
used for creating distributed applications. We may access files
by calling the methods from any machine on the internet.
Page 14
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.
The main advantage of multi-threading is that it shares the
same memory.
Thread are important for multi-media, web applications etc.
Page 15
Primary reason for the popularity of java
Java is platform independent
Java provides applets and servlets for use on the web.
Java is an object-oriented programming language.
Java is easy.
Page 19
What is bytecode?
Machine-independent code generated by the JAVA compiler
and executed by the java interpreter
The executable form of Java code that executes within the java
virtual machine(VM). Also called interpreted code, and p-code.
Bytecode is a term which has been used to denote various
forms of instruction sets designed for efficient execution by a
software interpreter as well as being suitable for further
compilation into machine code.
Page 20
Points to remember
Java is not just programming language; it is also platform.
The java programming language works only on the java
platforms.
The java virtual machine enables the same java application to
be used on heterogeneous platform.
The application are compiled into bytecode, which are
interpreted on the native platform at runtime.
Object Oriented programming is about identifying various data
types from the real world, and the kind of interactions that are
supported by those data types.
Object oriented programming supports the concepts of data
encapsulations, inheritance, and polymorphism.
Page 21
First program of JAVA
class Hello
{
public static void main(String args[])
{
System.out.println(“Hello World”);
}
}
Note: Filename and public classname should be same….
Page 22
Next step to run JAVA program
Go to command prompt (Run->cmd.exe)
Set directory to your working directory where you have saved
your file (C:\myprog)
C: (To change current drive to c if you are working on other
drive)
cd myprog (to change drive to myprog)
javac Hello.java (Compile Program)
java Hello (run program (make sure to run using class name))
Page 24
JDK (JAVA DEVELOPMENT KIT)
The java development kit (JDK) is an implementation of either
one of Java SE, Java EE, or Java ME platforms released by
oracle corporation in the form of a binary product aimed at java
developers on Solaris, Linux, Mac OS x or Windows.
On 17th November 2006, sun announced that it would be
released under GNU (General Public License), thus making it
free software. This happened in large part on 8 may 2007, when
sun contributed the source code to the openJDK.
Page 25
JDK VERSIONS
JDK Alpha and Beta(1995)
JDK 1.0 (January 23, 1996)
JDK 1.1 (February 19, 1997)
J2SE 1.2 (December 8,1998)
J2SE 1.3 (May 8, 2000)
J2SE 1.4 (February 6,2002)
J2SE 5.0 (September 30, 2004)
JAVA SE 6 (December 11, 2006)
Page 27
JRE (JAVA RUNTIME ENVIORNMENT)
A java virtual machine is a program which executes certain other
programs, namely those containing java bytecode instructions.
JVM are most often implemented to run on an existing operating
system, but can also be implemented to run directly on hardware.
A JVM provides a run-time environment in which java bytecode
can be executed, enabling features such as automated exception
handing, which provides root-cause debugging information for
every software error.
A JVM is distributed along with Java class Library, a set of
standard class libraries (in java bytecode) that implement the java
application programming interface(API). This libraries , bundled
together with the JVM, from the Java Runtime Environment (JVM)
Page 28
Assignment
Explain how platform independence is achieved in java
Explain the concept of data encapsulation, inheritance and
polymorphism in object oriented programming language
Define Bytecode
List and explain the features of java
Why java is so popular
How many different types of program can be created in java?
Explain in detail