10
We will talking about story of JAVA We will talking about story of JAVA language. language. By Kristsada Songpartom By Kristsada Songpartom

We will talking about story of JAVA language. By Kristsada Songpartom

Embed Size (px)

Citation preview

Page 1: We will talking about story of JAVA language. By Kristsada Songpartom

We will talking about story of JAVA language.We will talking about story of JAVA language.

By Kristsada SongpartomBy Kristsada Songpartom

Page 2: We will talking about story of JAVA language. By Kristsada Songpartom

Java works well for web and serverJava works well for web and server--based applicationsbased applications. . It has great features like objectIt has great features like object--oriented programming, easy database access, and oriented programming, easy database access, and wellwell--designed GUI supportdesigned GUI support..Java has Java has performance tperformance tweaks to speed up desktop programs. There are libweaks to speed up desktop programs. There are libraries for communicating across networks, and for raries for communicating across networks, and for encryption. It has strong security built in. Most proencryption. It has strong security built in. Most programmers pick up Java quickly. Behind all this, Jagrammers pick up Java quickly. Behind all this, Java is more than just the latest, most popular prograva is more than just the latest, most popular programming language. It is a way of creating applicatiomming language. It is a way of creating applications that are independent of all hardware and all operns that are independent of all hardware and all operating systems. ating systems.

Page 3: We will talking about story of JAVA language. By Kristsada Songpartom

History of JAVAHistory of JAVA Sun Microsystems in 1991 funded an internal Sun Microsystems in 1991 funded an internal

corporate research corporate research project code-named Green, whiproject code-named Green, which resulted in the development of a C++-based lanch resulted in the development of a C++-based language that its creator, James Gosling, called Oak afguage that its creator, James Gosling, called Oak after an oak tree outside his window at Sun. It was later an oak tree outside his window at Sun. It was later discovered that there already was a computer later discovered that there already was a computer language called Oak. When a group of Sun people vinguage called Oak. When a group of Sun people visited a local coffee shop, the name Java was suggesited a local coffee shop, the name Java was suggested, and it stuck.sted, and it stuck. And Sun formally announced And Sun formally announced Java at a major conference in May 1995Java at a major conference in May 1995. .

Page 4: We will talking about story of JAVA language. By Kristsada Songpartom

Why must be JAVA ?Why must be JAVA ? We want software that works—consistently, We want software that works—consistently,

anywhere, on any platform—and that plays well anywhere, on any platform—and that plays well with other applicationswith other applications. . We want dynamic We want dynamic applications that take advantage of a applications that take advantage of a connected woconnected world, capable of accessing disparate and distributed irld, capable of accessing disparate and distributed information sources. We want truly distributed softnformation sources. We want truly distributed software that can be extended and upgraded seamlesslware that can be extended and upgraded seamlessly. We want intelligent applications—such as autony. We want intelligent applications—such as autonomous agents that can roam the Net for us, ferretinomous agents that can roam the Net for us, ferreting out information and serving as electronic emissarg out information and serving as electronic emissaries. ies.

Page 5: We will talking about story of JAVA language. By Kristsada Songpartom

Primary goalsPrimary goals There were five primary goals in the creation of the There were five primary goals in the creation of the

Java language Java language 11. . It should use the objectIt should use the object--oriented programming oriented programming

methodologymethodology. . 2. It should allow the same program to be executed on mult2. It should allow the same program to be executed on mult

iple operating systems. iple operating systems. 33. . It should contain builtIt should contain built--in support for using computer in support for using computer

networksnetworks. . 4. It should be designed to execute code from remote sourc4. It should be designed to execute code from remote sourc

es securely. es securely. 55. . It should be easy to use by selecting what were It should be easy to use by selecting what were

considered the good parts of other objectconsidered the good parts of other object--oriented oriented languageslanguages. .

Page 6: We will talking about story of JAVA language. By Kristsada Songpartom

Main features of the JAVAMain features of the JAVA

""Write once, run anywhereWrite once, run anywhere" (" (WORAWORA))

Java can be developed on any device, Java can be developed on any device, compiled into a standard bytecode and be compiled into a standard bytecode and be expected to run on any device equipped with a expected to run on any device equipped with a Java virtual machine Java virtual machine ((JVMJVM). ). The installation The installation of a JVM or Java interpreter on chips.of a JVM or Java interpreter on chips.

Page 7: We will talking about story of JAVA language. By Kristsada Songpartom

Some Some goodgood things about things about JavaJava JavaJava has a garbage collector so there are no destructors. Memory m has a garbage collector so there are no destructors. Memory m

anagement is handled by the system, not by each program. anagement is handled by the system, not by each program. JavaJava catches all array subscript errors and similar. catches all array subscript errors and similar. JavaJava never has u never has u

ninitialized data of any kind. Order of evaluation, etc. is completely ninitialized data of any kind. Order of evaluation, etc. is completely defined and natural. defined and natural.

JavaJava arrays know their own length. (a public read-only field named arrays know their own length. (a public read-only field named length.) length.)

JavaJava never has dangling references. You still can't derefernce null, h never has dangling references. You still can't derefernce null, however. If you try it will be caught. This is probably the most commowever. If you try it will be caught. This is probably the most common run time error. on run time error.

JavaJava int, float, int, float,... ... are completely defined, so behave the same on all are completely defined, so behave the same on all systems supporting systems supporting JavaJava. . Int is 32 bits with modular arithmeticInt is 32 bits with modular arithmetic. . In In fact the only fact the only thingthing in in JavaJava not specified is the effect of the not specified is the effect of the interleaving of threads in a multithreaded programinterleaving of threads in a multithreaded program. . All casts are All casts are checked, either at compile time or at runtimechecked, either at compile time or at runtime. . A narrowing cast is A narrowing cast is never applied automaticallynever applied automatically..

Page 8: We will talking about story of JAVA language. By Kristsada Songpartom

JavaJava interfaces define first class types. This gives most of the interfaces define first class types. This gives most of the strength of both strength of both CC++++ templates and multiple inheritance. Interf templates and multiple inheritance. Interfaces are very important in aces are very important in JavaJava. .

JavaJava has threads, so concurrent programs are possible with has threads, so concurrent programs are possible with standard toolsstandard tools. .

JavaJava has a library with lots of common data structures. has a library with lots of common data structures.

Page 9: We will talking about story of JAVA language. By Kristsada Songpartom

Some bad things about Some bad things about Java Java

((Actually these things are Actually these things are goodgood, but are placed here, but are placed here

since they complicate novice learningsince they complicate novice learning.).)

II//O takes explanation and getting used toO takes explanation and getting used to. Java. Java standard standard output is easyoutput is easy. Java. Java standard input is harder standard input is harder. . Other Other inputinput//output is hardoutput is hard. (. (But its object model is very But its object model is very good.)good.)

JavaJava exceptions must be caught and i/o statements throw e exceptions must be caught and i/o statements throw exceptions.xceptions.

Page 10: We will talking about story of JAVA language. By Kristsada Songpartom

Simple ProgramsSimple Programs Hello Java program.Hello Java program.publicpublic classclass helloJava { helloJava {

publicpublic staticstatic voidvoid main(String[] args) { main(String[] args) {String hello = "Hello Java";String hello = "Hello Java";System.System.outout.println(hello);.println(hello);

//the program will show hello and we want to add number then see below.//the program will show hello and we want to add number then see below.intint a = 321; a = 321;intint b = 123; b = 123;intint c = a+b; c = a+b;intint d = a+b*c+1+2+3; d = a+b*c+1+2+3;System.System.outout.println(c);.println(c);System.System.outout.println(d);.println(d);

}}}} We have more information in httpWe have more information in http://://garnetgarnet..cpecpe..kuku..acac..thth//wikiwiki//indexindex..phpphp//JAVAJAVA