Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction To Java Objectives For Today â Introduction To Java â The Java Platform & The (JVM) Java Virtual Machine â Core Java (API) Application Programming.

Similar presentations


Presentation on theme: "Introduction To Java Objectives For Today â Introduction To Java â The Java Platform & The (JVM) Java Virtual Machine â Core Java (API) Application Programming."— Presentation transcript:

1 Introduction To Java Objectives For Today â Introduction To Java â The Java Platform & The (JVM) Java Virtual Machine â Core Java (API) Application Programming Interface â Java Applications & Applets

2 What Is Java ? âAn Object Oriented Language and platform developed by Sun Micro Systems that is machine independent and can be used to write applications and applets for the internet. âDeveloped initially for home electronics as a language that could be used with any microprocessor in the home on devices such as converters and remote controls. âSun saw a benefit for such a language and realized it could be applied to computing and the internet. âWrite once run anywhere. Pure Java programs are compiled into machine-independent byte-code which runs consistently on any platform.

3 The authors of Java have written the Java “White Paper” that explains their design goals and accomplishments. The paper is organized around the following buzzwords: Simple â Powerful but easy to learn in comparison to other object oriented languages. (ie. C++ not VB) Object Oriented â Concentrates on the data represented in objects that have both a state and behavior. â As a developer, you concentrate on the data in your objects and then the methods that act upon them. Introduction To Java

4 Object Oriented â This differs significantly from procedural based programming where the focus was on the procedures of the program, not the data being manipulated. â Java comes with a rich set of classes that you can re-use to to build your own programs. â For example, Java provides a set of classes you can use to create a Graphical user interface. â Almost everything in Java is an object except the primitive data types you are familiar with. (integers, doubles etc.) Introduction To Java

5 Interpreted & Distributed Interpreted â Java contains a compiler that translates Java source code into byte-code for the Java Virtual Machine. â Byte-code is machine independent which means it is not dependent on the native machine code. â It can run on any platform. Distributed â Distributed simply means Java provides a lot of support for networking. Introduction To Java

6 Distributed â Java can read remote files and resources across networks almost as easily as reading from the local file system. â Java also allows for objects to send messages to one another across networks as if they were local objects. â This is called RMI. (Remote Method Invocation) Robust â Java puts considerable emphasis on early checking for possible problems,dynamic(run-time) checking, and eliminating situations that are error prone.

7 â Java has built in security features that verifies code before it is executed if it originates from an unknown source. â Applets are Java programs that come from unknown sources and run within the confines of your browser. â Applets that come from sources not trusted are placed in what is commonly called a sandbox inside your browser. â As a result Applets are limited as to what they can do and cannot do the following: â Read Files, Write Files, Delete Files, Rename Files. Introduction To Java Secure:

8 Architecture Neutral & Portable â As mentioned earlier, the Java compiler generates byte-code for the Java Virtual Machine. â Byte-codes can run on any platform such as Mac, Unix, Windows, etc. â Java can run on any platform as long as that system implements the Java Virtual Machine (JVM) Introduction To Java

9 High Performance â Java is an interpreted language. â It is not as fast as compiled languages such as C but is still more than adequate to run interactive GUI and Network based applications. â However, you can get Just In Time (JIT) compilers in Java that can translate byte-code into machine code for a particular CPU. Introduction To Java

10 Multithreaded â Java allows the user to program multiple threads, which are small programs that run simultaneously. â A developer may want to write a program that plays an audio clip. â At the same time a the program may have the capability to download a file. Introduction To Java

11 Dynamic â Java was designed to be dynamic. â Java is a language that can adapt to a changing environment. â As time passes, new API Classes are developed that can easily be implemented with already existing Classes. Introduction To Java

12 The Java Platform The Java Platform consists of the following: â The Java Virtual Machine (JVM)  Java compiler and interpreter â Java Core Classes (API) (Application Programming Interface) â Java Documentation â Java Development Kit (JDK) incorporates all points above.

13 The Java Virtual Machine â You can think of the JVM as a computer integrated in software on your computer. â When you compile Java source code it is compiled into byte-codes. â The JVM is capable of interpreting these instructions in the form of machine independent byte-codes. â This is the key to a Java programs portability. â As long as your computer runs the JVM or your web browser is Java enabled, you will be able to execute Java byte-codes and therefore run Java Applications and Applets.

14 How Java Works

15 The Java Core Classes (API) â When programming in Java you have access to a rich set of programming elements called Classes. â You can use these Classes to build your programs. ie java.utilVector java.langString â These classes are called the Java Core Classes. â The JDK documentation provides a complete list of the core classes and their specifications. â Let’s take a look at the JDK documentation.

16 The Java Development Kit (JDK) How do we build Java Applications and Applets? â We use the Java Development Toolkit which includes the JVM, the core API and various tools. â We can use a set of tools provided by Java. These tools are located in the jdk bin directory on your computer. â Some of the tools you will come most familiar with are: javac compiles java files into byte-code java runs class files (also called the interpreter) appletviewer built in browser for running applets javadoc compiles javadoc comments in html format â These tools are very crude and are run from the dos prompt.

17 The Tools We Will Use Text Editors â We will begin our work in Java using text editors to create simple Applications and Applets. â Any text editor can be used, but we will use: Notepad Text Pad âShareware version of Text Pad has been installed for you on the image.

18 The Tools We Will Use Visual Age For Java â An application development tool from IBM. (Version 2) â Visual Age greatly enhances our ability to develop applications and applets by providing us with these key features: IDE (Integrated Development Environment) Workbench (Organizes packages and classes) Smart Guides (Similar to wizards in MS Access) VCE (Visual Composition Editor) Visual Age Debugger

19 Java Applications Run stand alone in the JVM All applications have a starting point public static void main (String [] args) {} Can be simple command line programs or more advanced GUI programs that we are use to. Demonstration of a simple Java Application

20 Java Applets Run in web browser or appletviewer Invoked by HTML tags Call must extend: java.applet.Applet Use methods: init, start, paint, stop, destroy Demonstration of a simple Java Applet


Download ppt "Introduction To Java Objectives For Today â Introduction To Java â The Java Platform & The (JVM) Java Virtual Machine â Core Java (API) Application Programming."

Similar presentations


Ads by Google