1 / 28

Lecture 1

Lecture 1. INTRODUCTION. Outcome of the Lecture. Upon completion of this lecture you will be able to understand Fundamentals and Characteristics of Java Language Basic Terminology – JVM, JRE, API, JDK, IDE, bytecode Writing, Compiling and Executing Java Program.

adoran
Download Presentation

Lecture 1

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Lecture 1 INTRODUCTION

  2. Outcome of the Lecture Upon completion of this lecture you will be able to understand Fundamentals and Characteristics of Java Language Basic Terminology – JVM, JRE, API, JDK, IDE, bytecode Writing, Compiling and Executing Java Program

  3. Outline of the Presentation • Overview of Java • History of Java • Java Standards • Editions of Java • JDK and IDE • Characteristics of Java • Sample Java Program • Creating, Compiling and Executing Java Program • Java Runtime Environment (JRE) and Java Virtual Machine (JVM)

  4. Overview of Java • A general-purpose Object-Oriented language • Developed by Sun Microsystems, later acquired by Oracle Corporation • Java can be used to develop • Stand alone applications • Web applications. • applications for hand-held devices such as Palm and cell phones

  5. History of Java • Developed by a team led by James Gosling at Sun Microsystems in 1991 for use in embedded chips . • Originally called Oak. • In 1995 redesigned for developing Internet applications and renamed as Java • HotJava - The first Java-enabled Web browser (1995) • JDK Evolutions (in slide 9)

  6. Java Standards • Computer languages have strict rules of usage. Java standards are defined by • The Java language specification and • Java API • The Java language specification is a technical definition of the language that includes the syntax and semantics of the Java programming language. • The Application Program Interface (API) contains predefined classes and interfaces for developing Java programs. • Java language specification is stable, but the API is still expanding

  7. Editions of Java • Java Standard Edition (SE) • used to develop client-side standalone applications or applets. • Java Enterprise Edition (EE) • used to develop server-side applications such as Java servlets and Java ServerPages. • Java Micro Edition (ME). • used to develop applications for mobile devices such as cell phones. • Java Card: A technology that allows small Java-based applications to be run securely on smart cards and similar small-memory devices. • We will be using Java SE

  8. Java Development Kit (JDK) JDK consists of a set of separate programs, each invoked from a command line, for developing and testing Java programs. There are many versions of Java SE. JDK 1.02 (1995) JDK 1.1 (1996) Java 2 SDK v 1.2 (JDK 1.2, 1998) Java 2 SDK v 1.3 (JDK 1.3, 2000) Java 2 SDK v 1.4 (JDK 1.4, 2002) and so on… The latest is JDK1.8 We will be using JDK1.7

  9. Integrated Development Environment (IDE) • Besides JDK, a Java development tool—software that provides an integrated development environment (IDE) for rapidly developing Java programs can be used. • Editing, compiling, building, debugging, and online help are integrated in one graphical user interface. • Borland Jbuilder • Microsoft Visual J++ • Net Beans • Eclipse • BlueJ • We will be using JDK1.7

  10. Characteristics of Java • Java Is Simple • Java Is Object-Oriented • Java Is Distributed • Java Is Interpreted • Java Is Robust • Java Is Secure • Java Is Architecture-Neutral • Java Is Portable • Java's Performance • Java Is Multithreaded • Java Is Dynamic

  11. Characteristics of Java • Java Is Simple • Java Is Object-Oriented • Java Is Distributed • Java Is Interpreted • Java Is Robust • Java Is Secure • Java Is Architecture-Neutral • Java Is Portable • Java's Performance • Java Is Multithreaded • Java Is Dynamic Java is partially modeled on C++, but greatly simplified and improved

  12. Characteristics of Java • Java Is Simple • Java Is Object-Oriented • Java Is Distributed • Java Is Interpreted • Java Is Robust • Java Is Secure • Java Is Architecture-Neutral • Java Is Portable • Java's Performance • Java Is Multithreaded • Java Is Dynamic Java is inherently object-oriented. Object-oriented programming provides great flexibility, modularity, clarity, and reusability through encapsulation, inheritance, and polymorphism

  13. Characteristics of Java • Java Is Simple • Java Is Object-Oriented • Java Is Distributed • Java Is Interpreted • Java Is Robust • Java Is Secure • Java Is Architecture-Neutral • Java Is Portable • Java's Performance • Java Is Multithreaded • Java Is Dynamic Distributed computing involves several computers working together on a network. Java is designed to make distributed computing easy.

  14. Characteristics of Java • Java Is Simple • Java Is Object-Oriented • Java Is Distributed • Java Is Interpreted • Java Is Robust • Java Is Secure • Java Is Architecture-Neutral • Java Is Portable • Java's Performance • Java Is Multithreaded • Java Is Dynamic You need an interpreter to run Java programs. The programs are compiled into the Java Virtual Machine code called bytecode. The bytecode is machine-independent and can run on any machine that has a Java interpreter, which is part of the Java Virtual Machine (JVM).

  15. Characteristics of Java • Java Is Simple • Java Is Object-Oriented • Java Is Distributed • Java Is Interpreted • Java Is Robust • Java Is Secure • Java Is Architecture-Neutral • Java Is Portable • Java's Performance • Java Is Multithreaded • Java Is Dynamic Java compilers can detect many problems that would first show up at execution time in other languages. Java has eliminated certain types of error-prone programming constructs found in other languages. Java has a runtime exception-handling feature to provide programming support for robustness.

  16. Characteristics of Java • Java Is Simple • Java Is Object-Oriented • Java Is Distributed • Java Is Interpreted • Java Is Robust • Java Is Secure • Java Is Architecture-Neutral • Java Is Portable • Java's Performance • Java Is Multithreaded • Java Is Dynamic Java implements several security mechanisms to protect your system against harm caused by stray programs.

  17. Characteristics of Java • Java Is Simple • Java Is Object-Oriented • Java Is Distributed • Java Is Interpreted • Java Is Robust • Java Is Secure • Java Is Architecture-Neutral • Java Is Portable • Java's Performance • Java Is Multithreaded • Java Is Dynamic Write once, run anywhere With a Java Virtual Machine (JVM), you can write one program that will run on any platform.

  18. Characteristics of Java • Java Is Simple • Java Is Object-Oriented • Java Is Distributed • Java Is Interpreted • Java Is Robust • Java Is Secure • Java Is Architecture-Neutral • Java Is Portable • Java's Performance • Java Is Multithreaded • Java Is Dynamic Because Java is architecture neutral, Java programs are portable. They can be run on any platform without being recompiled.

  19. Characteristics of Java • Java Is Simple • Java Is Object-Oriented • Java Is Distributed • Java Is Interpreted • Java Is Robust • Java Is Secure • Java Is Architecture-Neutral • Java Is Portable • Java's Performance • Java Is Multithreaded • Java Is Dynamic Java’s performance Because Java is architecture neutral, Java programs are portable. They can be run on any platform without being recompiled.

  20. Characteristics of Java • Java Is Simple • Java Is Object-Oriented • Java Is Distributed • Java Is Interpreted • Java Is Robust • Java Is Secure • Java Is Architecture-Neutral • Java Is Portable • Java's Performance • Java Is Multithreaded • Java Is Dynamic Multithread programming is smoothly integrated in Java, whereas in other languages you have to call procedures specific to the operating system to enable multithreading.

  21. Characteristics of Java • Java Is Simple • Java Is Object-Oriented • Java Is Distributed • Java Is Interpreted • Java Is Robust • Java Is Secure • Java Is Architecture-Neutral • Java Is Portable • Java's Performance • Java Is Multithreaded • Java Is Dynamic Java was designed to adapt to an evolving environment. New code can be loaded on the fly without recompilation. There is no need for developers to create, and for users to install, major new software versions. New features can be incorporated transparently as needed.

  22. Sample Java Program import java.lang.*; // Optional public class Welcome { public static void main(String[] args) { System.out.println("Welcome to Java!"); } }

  23. Creating, Compiling and Executing Java Program • Use any text editor or IDE to create and edit a Java source-code file • The source file must end with the extension .java and must have exactly the same name as the public class name Welcome.java • Compile the .java file into java byte code file (Java bytecode is the instruction set of the Java virtual machine) • javac Welcome.java • If there are no syntax errors, the compiler generates a bytecode file • with .class extension • Run the byte code - java Welcome

  24. Creating, Compiling and Executing Java Program

  25. JDK vs JRE vs JVM • Java Developer Kit contains tools needed to develop the Java programs, and JRE to run the programs. The tools include compiler (javac.exe), Java application launcher (java.exe), Appletviewer, etc… Compiler converts java code into byte code. Java application launcher opens a JRE, loads the class, and invokes its main method. • Java Runtime Environment contains JVM, class libraries, and other supporting files. It does not contain any development tools such as compiler, debugger, etc. Actually JVM runs the program, and it uses the class libraries, and other supporting files provided in JRE. • Java Virtual Machine interprets the byte code into the machine code depending upon the underlying operating system and hardware combination. It is responsible for all the things like garbage collection, array bounds checking, etc… JVM is platform dependent.

  26. Java life, cont..

  27. JVM an Portability • Through the Java VM, the same application is capable of running on multiple platforms.

More Related