road map today o Brief intro to Java o Develop and compile environment ●A simple example Intro to object/class ●Java basics ●Differences from C
road map today lBrief intro to Java lDevelop and compile environment lA simple example lIntro to object/class lJava basics lDifferences from C
Intro to Java o Java programming language OThe one we use to write our program O Compiled to byte code of JVM Java virtual machine (JVM) O Java interpreter-interpret the compiled byte code O Software simulated CPU architecture OCross-platform:support Linux,Windows,PalmOS...etc. Java runtime environment(JRE) O Predefined set of java classes available to use OCore Java APls-basic utilities,1/O,graphics, network
Intro to Java l Java programming language ¡The one we use to write our program ¡Compiled to byte code of JVM l Java virtual machine (JVM) ¡Java interpreter – interpret the compiled byte code ¡Software simulated CPU architecture ¡Cross-platform: support Linux, Windows, PalmOS…etc. l Java runtime environment (JRE) ¡Predefined set of java classes available to use ¡Core Java APIs – basic utilities, I/O, graphics, network…
Java is portable, OAs long as there is a JVM compiled for that particular processor and OS Typical program,like C or C++,is compiled for a particular processor architecture and OS. o"Write once,run everywhere!" ○Sun's motto for Java
Java is portable, lAs long as there is a JVM compiled for that particular processor and OS lTypical program, like C or C++ , is compiled for a particular processor architecture and OS. l“Write once, run everywhere!” ¡Sun’s motto for Java
Bottom line:slow but safe o Not suitable for high-performance computation O Scientific computation,games,OS kernel O Compiled to byte codes of JVM,not native machine language instructions O New release of Java is improving the speed a lot Just-in-time (JIT)compiler:convert byte codes to native machine language on the fly ●Very safe ONo pointer OAutomatic garbage collection O Check array access bound
Bottom line: slow but safe l Not suitable for high-performance computation ¡Scientific computation, games, OS kernel ¡Compiled to byte codes of JVM, not native machine language instructions ¡New release of Java is improving the speed a lot lJust-in-time (JIT) compiler: convert byte codes to native machine language on the fly l Very safe ¡No pointer ¡Automatic garbage collection ¡Check array access bound
Java Java is an object-oriented language,with a syntax similar to C OStructured around objects and methods OA method is an action or something you do with the object Avoid those overly complicated features of C++: OOperator overloading,pointer,templates,friend class,etc
Java lJava is an object-oriented language, with a syntax similar to C ¡Structured around objects and methods ¡A method is an action or something you do with the object lAvoid those overly complicated features of C++: ¡Operator overloading, pointer, templates, friend class, etc