160 likes | 381 Views
Lec . 01: Java fundamentals. Contents. Brief history of Java Features of Java JDK, JRE, JVM and bytecode Developing and executing Java programs Basic syntax and semantics of Java. Java technology.
E N D
Lec. 01: Java fundamentals Java Programming
Contents • Brief history of Java • Features of Java • JDK, JRE, JVM and bytecode • Developing and executing Java programs • Basic syntax and semantics of Java Java Programming
Java technology • Java technology is a software-only platform running on top of other hardware-based platforms. • Including • Java programming language • A general-purpose, concurrent, strongly typed, class-based object-oriented language • Tools • Compiler, debugger, documentation tool, launcher, web service, … • Application Programming Interfaces (APIs) • Large amount ready-made software components to make programming easier • Deployment methodology • Java Web Start, Java plug-in • Integration libraries • JDBC, JNDI, Java RMI • Java Virtual Machine (JVM) Java Programming
Past of Java • Conceived by a design team of Sun Microsystems in 1991 • Original language goal • A platform-independent language that could be used to create software to be embedded in various consumer electronic devices • Switching to Internet programming with the emergence of the World Wild Web • The syntax and object model of Java inherits from C and C++ respectively. Java Programming
Features of Java including … • Highly portable • Highly dynamic • Suitable for distributed architectures • Highly secure • Object-oriented • Robust • Hybrid of compiling and interpreting • Multithreaded Java Programming The secret to make Java platform-independent and secure is the JVM (Java Virtual Machine) and Java bytecode.
Types of Java programs • Based on the usages and runtime environments, Java programs are classified as: • Stand-alone programs • Java applets • Java servelets • JavaBeans • The syntactic and semantic rules are the same for these four types of Java programs. • The differences among them are the APIs required to develop and execute programs. Java Programming
Stand-alone Java programs • A stand-alone Java program (also called Java application) can be only executed on the computer where the program is stored. • Two types of stand-alone programs • Console mode • Window mode Java Programming
Java applets • An applet is a special kind of Java program that is designed to be transmitted over the Internet and automatically executed by a Java-compatible web browser. • An applet is downloaded automatically when users click hyperlink containing applets, without further interaction with the user. • Applets are small programs which are typically used to display data provided by the server, handle user input, or provide simple functions, such as a loan calculator, that execute locally, rather than on the server. • Applets greatly reduce the load of servers. Java Programming
Java servelets • A java servlet runs within a Web server which receives and responds to requests from Web clients, where the requests are transmitted via HTTP (Hyper Text Transport Protocol). Java Programming
Javabeans • A bean is a Java class with method names that follow the JavaBeans API specifications. • Since all the beans follow the same specifications, they are easily to be integrated with other programs. • For example, all the Java classes supported by IDE (Integrated Development Environment), such as Eclipse and NetBeans, are Java beans. • A bean is used as a help class, instead of a driven class. • A help class is used to provide specific functions such as JButton, JFrame. • A driven class is used to control the process of a task. Java Programming
JDK • Java Development Kit (JDK) is a collection of software which constructs an environment for developing Java programs. • JDK editions • Java Standard Edition (J2SE) • J2SE can be used to develop client-side standalone applications or applets. • Java Enterprise Edition (J2EE) • J2EE can be used to develop server-side applications such as Java servlets and Java ServerPages. • Java Micro Edition (J2ME) • J2ME can be used to develop applications for mobile devices such as cell phones. Java Programming
JRE • The JRE (Java Runtime Environment) is a collection of software which creates an environment for running Java program. • The JRE consists of the Java Virtual Machine (JVM), Java platform core classes, and supporting Java platform libraries. Java Programming
Java bytecode and JVM • Java bytecode is a intermediate language, instead of the executable code of any specific platform, generated from Java compiler. • Currently, some other languages, such as Python and Ada, can be translated into Java bytecode. • JVM is a virtual machine (i.e. a software implemented abstraction of a specific underlying platform) which supports the running environment for interpreting Java bytecodes. • JVMs may be developed by any company as long as it adhere to the JVM specification published by Oracle Corporation and to related contractual obligations. • To execute Java bytecodes, they are either interpreted by JVM or translated to native language, by using JIT (Just-In-Time) compiler, for execution. Java Programming
The output of the compiler is .class file Java Programming