4. HISTORY OF JAVA
Java Is A Object Oriented Programming Language
Developed By James Gosling In Year 1991.
Java, May 20, 1995, Sun World.
Originally Language Name Oak.
It Said To Be The Name Java Is Come From Several
Individuals Involved In This Project James Gosling ,
Arthur , Van Goff And Andy Bechto Lsheim.
Name Changed To Java.
5. HISTORY OF JAVA
Java is popular and powerful language.
The java language was derived from c++
Much of the syntax in java is similar to c and
c++.
Java does not have pointer features.
Java supports WORA concept means write once,
run anywhere.
First Public Release In 1995.
5
6. HISTORY OF JAVA
Java is high level language that looks
very similar to c and c++ but offers many
unique features of its own.
6
7. WHERE JAVA IS USED ?
According to sun, 3 billions devices run on
java. There are many devices where java is
currently used some of them are as :-
Desktops
Web
Mobile
7
Embedded system
Smart card
Robotics
Games
15. FEATURES OF JAVA
Java is simple
Java is object-oriented
Java is platform independent
Java is distributed
Java is interpreted
Java is robust
15
16. FEATURES OF JAVA
Java is secure
Java is architecture-neutral
Java is portable
High performance
Java is multithreaded
Java is dynamic
16
17. WHY JAVA IS SIMPLE ?
1. Syntax is based upon c++.
2. Removed many confusing and lorrarely used
features (explicit pointer,operator overloding).
3. No need to remove unreferenced objects
because there is automatic grabage collection
in java.
17
18. WHAT IS OBJECT ORIENTED?
Object oriented means we organize our software
as a combination of different types of object that
incorporates both data and behavior.
It is methodology that simplify software
development and maintenance by providing some
rules.
We can do program with the help of object
18
iding
19. BASIC CONCEPT OF OPPS
Basic concept of OPPS are:-
1.Objects
2.Class
3.Inheritance
4.Abstraction
5.Encapsulation
6.Polymorphism
7.Data hiding
19
20. WHY JAVA IS PLATFORM
INDEPENDENT?
What is platform?
A platform is the hardware and software environment in which
programs runs.
Java is platform independent because its byte code can be run on
multiple platforms.
Like as:- windows, Linux, Unix, sun Solaris, Mac/OS etc.
That is write onces and run anywhere (WORA).
20
21. WHY JAVA IS MORE SECURED ?
1. Java is more secure because no explicit pointer use in java.
2. Programs run inside the virtual machine sandbox.
3. Class loader adds security by separating the package for the
classes of the local file system from those that are imported
from network sources.
4. Byte code verifier checks the code fragments for illegal code
that can violate access right to object.
5. Some security can also provided by application
developer through SSL, JAAS, cryptography etc.
21
22. ROBUST
Robust simply means error tolerance . java uses strong
memory management . There are lack of pointer that
avoids security problems. There is automatic garbage
collection in java . There is exception handling and type
checking mechanism in java. All these pointer makes
java robust .
22
23. ARCHITECTURAL NATURAL
There is no implementation dependent features its
means it is independent of any hardware
configuration.
23
PORTABLE
We may carry the java byte code to any
platform very easily.
24. HIGH PERFORMANCE
Java is better and faster than traditional
interpretation since byte code is “close” to
native code still some what slower than a
complied language like c++.
24
25. DISTRIBUTED
We can create distributed application in java.
RMI and EJB are used for creating
distributed application. We may access files
by calling the methods from any machine on
the internet.
25
26. MULTITHEADED
A Thread Is Like A Separate Program Executing,
Concurrently. We Can Write java program that deal
with many tasks at once by defining multiple
threads. The main advantage of multithreading is
that it shares the same memory. Threads are
important for multimedia ,web application etc.
26
27. CREATING “HELLO JAVA”
PROGRAMMING EXAMPLE.
Class simple{
public static void main(String args[])
{
System.out.println(“hello java”);
}
}
27
28. Save this file as simple.java.
To compile javac simple.java
To execution(run time) java simple
Output hello java.
28
29. CLASS
The classis the essential Java construct. A class is a
template or blueprint for objects. To program in Java,
you must understand classes and be able to write and
use them. The mystery of the class will continue to be
unveiled throughout this book. For now, though,
understand that a program is defined by using one or
more classes.
29
30. WHAT IS STATIC?
Static is a keyword, if we declare any method
(function) as static ,it is known as static method.
The core advantage of static method is that there Is
no need to create object to invoke the static method.
The main method is executed by the JVM so it
doesn’t require to create object to invoke the main
method ,so it saves memory.
30
ct to
31. VOID & STRING ARGS[]
Void is the return type method (function) . It
means it doesn’t return any values.
Main represent startup of the program.
String args[] is used command line argument.
System.out.println()
It is used for print the statement.
31
32. HOW TO SET PATH OF JDK IN WINDOWS
Path is required for using tools such as javac.java
etc. if you are saving the java file in jdk/bin folder,
path is not required but if you are having your java
file outside the JDK/bin folder. It is necessary to set
path JDK. There are two ways to set path of JDK.
1.Temporary
2.permanently
32
33. SETTING OF TEMPORARY PATH
For setting the temporary of JDK, you need to follow
these steps:-
1.Open command prompt
2.Copy the path of bin folder
3.Write in command prompt
4. Set path= copied path
c:programfilesjavajdk 1.7.0 25bin;.;
33
34. JAVA PROGRAM
public class testrrr
{
public static void main (String args[])
{
for(int i=0,j=10;i<10;i++,j++)
{
System.out.println(i+" "+j);
}
}
}
34
38. 38
interface DeclareStuff
{
public static final int EASY =3;
void doStuff(int t);
}
public class TestDeclare implements DeclareStuff
{
public static void main(String args[])
{
int x = 5;
new TestDeclare().doStuff(++x);
}
public void doStuff(int s)
{
s += EASY - ++s;
System.out.println("s"+--s);
}
}
42. 42
class A
{
A(){System.out.println("A class constructor");}
{System.out.println("annonymous block in class
A");}
void display(){System.out.println("display in class
A");}
}
class B extends A
{
B(){System.out.println("B class constructor");}
{System.out.println("annonymous block in class
B");}
void display(){System.out.println("display in class
B");}
}
class C extends B
{
C(){System.out.println("C class constructor");}
class D extends C
{
D(){System.out.println("D class constructor");}
{System.out.println("annonymous block in class
D");}
void display(){System.out.println("display in class
D");}
public static void main(String args[])
{
C c1=new C();
c1.display();
}
}
48. DON’T TRY TO LEARN
JAVA JUST TRY TO LIVE
IT..
THANK YOU
48
Editor's Notes
First Class: Introduction, Prerequisites, Advices, Syllabus
Lab 1: Create a Java Project, Compile, and Run.
Show syntax errors
Print program
Capture screen shots, and save it in Word, and print it.
Homework One: Check in the class randomly.