48
IDEAL EYES BUSINESS COLLEGE A PRESENTATION 1 UPLOADED BY:- VIVEK KUMAR

Java basic introduction

Embed Size (px)

Citation preview

Page 1: Java basic introduction

IDEAL EYES BUSINESS COLLEGEA

PRESENTATION

1UPLOADED BY:- VIVEK KUMAR

Page 2: Java basic introduction

2

DEVELOPER OF JAVA:- JAMES GOSLING

Page 3: Java basic introduction

1991 1995 2009

1991 2010 2014 STIL..

Page 4: Java basic introduction

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.

Page 5: Java basic introduction

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

Page 6: Java basic introduction

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

Page 7: Java basic introduction

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 RoboticsGames

Page 8: Java basic introduction

DESKTOP

8

Page 9: Java basic introduction

WEB

9

Page 10: Java basic introduction

MOBILE PHONES

10

Page 11: Java basic introduction

EMBEDDED SYSTEM

11

Page 12: Java basic introduction

SMART CARD

12

Page 13: Java basic introduction

ROBOTICS

13

Page 14: Java basic introduction

GAMES

14

Page 15: Java basic introduction

FEATURES OF JAVA

Java is simple

Java is object-oriented

Java is platform independent

Java is distributed

Java is interpreted

Java is robust15

Page 16: Java basic introduction

FEATURES OF JAVA Java is secure

Java is architecture-neutral

Java is portable

High performance

Java is multithreaded

Java is dynamic16

Page 17: Java basic introduction

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

Page 18: Java basic introduction

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

Page 19: Java basic introduction

BASIC CONCEPT OF OPPSBasic concept of OPPS are:-1.Objects2.Class3.Inheritance4.Abstraction5.Encapsulation6.Polymorphism7.Data hiding

19

Page 20: Java basic introduction

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

Page 21: Java basic introduction

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

Page 22: Java basic introduction

ROBUSTRobust 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

Page 23: Java basic introduction

ARCHITECTURAL NATURAL

There is no implementation dependent features its means it is independent of any hardware configuration.

23

PORTABLEWe may carry the java byte code to any platform very easily.

Page 24: Java basic introduction

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

Page 25: Java basic introduction

DISTRIBUTEDWe 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

Page 26: Java basic introduction

MULTITHEADEDA 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

Page 27: Java basic introduction

CREATING “HELLO JAVA” PROGRAMMING EXAMPLE.

Class simple{public static void main(String args[]) { System.out.println(“hello java”); }}

27

Page 28: Java basic introduction

Save this file as simple.java.To compile javac simple.javaTo execution(run time) java simpleOutput hello java.

28

Page 29: Java basic introduction

CLASSThe 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

Page 30: Java basic introduction

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

Page 31: Java basic introduction

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

Page 32: Java basic introduction

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.Temporary2.permanently

32

Page 33: Java basic introduction

SETTING OF TEMPORARY PATH

For setting the temporary of JDK, you need to follow these steps:-1.Open command prompt2.Copy the path of bin folder3.Write in command prompt 4. Set path= copied path c:\program\files\java\jdk 1.7.0 25\bin;.;

33

Page 34: Java basic introduction

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

Page 35: Java basic introduction

35

OUTPUT WOULD BE

Page 36: Java basic introduction

1. 36

1. public class classA2. {3. public int getValue()4. {5. int value=0;6. boolean setting = false;7. String title="hello";8. if(setting && title == "hello")9. {10. System.out.println("first if

condition");11. return 1;12. }13. if(value == 1 &&

title.equals("hello"))14. {15. System.out.println("second if

condition");16. return 2;17. }

18. return 5;19. }20. public static void main(String args[])21. {22. classA a= new classA();23. int y=a.getValue();24. System.out.println("value of y is"+y);25. }26. }

Page 37: Java basic introduction

37

OUTPUT WOULD BE

Page 38: Java basic introduction

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);}}

Page 39: Java basic introduction

39

OUTPUT WOULD BE

Page 40: Java basic introduction

40

class c{public static void main (String args[]){int x=9;if(x == 9){int x=8;System.out.println(x);}}}

Page 41: Java basic introduction

41

OUTPUT WOULD BE

Page 42: Java basic introduction

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");}{System.out.println("annonymous block in class c");}void display(){System.out.println("display in class C");}}

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();}}

Page 43: Java basic introduction

43

OUTPUT WOULD BE

Page 44: Java basic introduction

44

class jump_statments{public static void main(String args[]){int x=2;int y=0;for(;y<10;++y){if(y%x==0)continue;else if(y==8)break;elseSystem.out.println(y+" ");}}}

Page 45: Java basic introduction

45

OUTPUT WOULD BE

Page 46: Java basic introduction

46

class output_test{public static void main(String args[]){int x,y=1;x=10;if (x!=10 && x/0 ==0)System.out.println(y);elseSystem.out.println(++y);}}

Page 47: Java basic introduction

47

OUTPUT WOULD BE

Page 48: Java basic introduction

DON’T TRY TO LEARN JAVA JUST TRY TO LIVE

IT..THANK YOU

48