Introduction to JAVA Vijayan Sugumaran School of Business Administration Oakland University Rochester, MI 48309.

Slides:



Advertisements
Similar presentations
What is a Computer Program? For a computer to be able to do anything (multiply, play a song, run a word processor), it must be given the instructions.
Advertisements

Introduction To Java Objectives For Today â Introduction To Java â The Java Platform & The (JVM) Java Virtual Machine â Core Java (API) Application Programming.
Lab Information Security Using Java (Review) Lab#0 Omaima Al-Matrafi.
Lab#1 (14/3/1431h) Introduction To java programming cs425
The Java Language. Topics of this Course  Introduction to Java  The Java Language  Object Oriented Programming in Java  Exceptions Handling  Threads.
Client Side Programming Using Java Applet Outcomes: You will be expected to know: – Java Applets and HTML file; –bytecode and platform independent programs;
got ? Research Project – April 1998 Hang Xia, Mark Wang, Richard S. Chang Updated: R Norman, August 1999.
Java: History and Introduction (Lecture # 1). History… Java – Based on C and C++ – Developed in 1991 for intelligent consumer electronic devices – Green.
Introduction to Java Kiyeol Ryu Java Programming Language.
CS884 (Prasad)Java Goals1 “Perfect Quote” You know you've achieved perfection in design, Not when you have nothing more to add, But when you have nothing.
Session-02. Objective In this session you will learn : What is Class Loader ? What is Byte Code Verifier? JIT & JAVA API Features of Java Java Environment.
Lecture 1: Overview of Java. What is java? Developed by Sun Microsystems (James Gosling) A general-purpose object-oriented language Based on C/C++ Designed.
Developing User Interfaces (DUI) Chris North cs3724: HCI.
Introduction to Java Programming. Contents 1. Java, etc. 2. Java's Advantages 3. Java's Disadvantages 4. Types of Java Code 5. Java Bytecodes 6. Steps.
Programming in Java; Instructor:Moorthy Introduction, Objects, Classes, Libraries1 Programming in Java Introduction.
JAVA v.s. C++ Programming Language Comparison By LI LU SAMMY CHU By LI LU SAMMY CHU.
BASIC JAVA PROGRAMMING TUTORIAL. History  James Gosling and Sun Microsystems  Oak  Java, May 20, 1995, Sun World  Hot Java –The first Java-enabled.
CSC 142 A 1 CSC 142 Introduction to Java [Reading: chapter 0]
Introduction to Java CSIS 3701: Advanced Object Oriented Programming.
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 4 Web technologies: HTTP, CGI, PHP,Java applets)
Java Introduction Lecture 1. Java Powerful, object-oriented language Free SDK and many resources at
Chapter 34 Java Technology for Active Web Documents methods used to provide continuous Web updates to browser – Server push – Active documents.
1 Module Objective & Outline Module Objective: After completing this Module, you will be able to, appreciate java as a programming language, write java.
University of Houston-Clear Lake Proprietary© 1997 Evolution of Programming Languages Basic cycle of improvement –Experience software difficulties –Theory.
Java Applets. 2 Introduction to Java Applet Programs  Applications are stand alone programs executed with Java interpreter executed with Java interpreter.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved Chapter 1 Introduction to.
POS 406 Java Technology And Beginning Java Code
1 Programming Fundamentals AITI-GP. 2 Introduction to Programming.
Web Pages with Features. Features on Web Pages Interactive Pages –Shows current date, get server’s IP, interactive quizzes Processing Forms –Serach a.
C# Versus Java Author: Eaddy, Marc Source: Software Tools for the Professional Programmer. Dr. Dobb's Journal. Feb2001, Vol. 26 Issue 2, p74 Hong Lu CS699A.
Introduction to Java Programming. Introduction Course Objectives Organization of the Book.
Java Applets. 2 Introduction to Java Applet Programs Applications are ___________________ programs –executed with Java interpreter Applet is a small program.
CSC 205 – Java Programming II Applet. Types of Java Programs Applets Applications Console applications Graphics applications Applications are stand-alone.
What Is Java? According to Sun in a white paper: Java: A simple, object-oriented, network-savvy, interpreted, robust, secure, architecture-neutral, portable,
National Taiwan University Department of Computer Science and Information Engineering National Taiwan University Department of Computer Science and Information.
CSE S. Tanimoto Java Introduction 1 Java A Programming Language for Web-based Computing with Graphics.
Java -- A very Hot Object- Oriented Language Instructors: Fu-Chiung Cheng ( 鄭福炯 ) Associate Professor Computer Science & Engineering Tatung Institute.
Computer Programming 2 Why do we study Java….. Java is Simple It has none of the following: operator overloading, header files, pre- processor, pointer.
We will talking about story of JAVA language. By Kristsada Songpartom.
CSE S. Tanimoto Java Introduction 1 Java A Programming Language for Web-based Computing with Graphics.
Web Pages with Features. Features on Web Pages Interactive Pages –Shows current date, get server’s IP, interactive quizzes Processing Forms –Serach a.
Lecture 1. Introduction to Programming and Java MIT- AITI 2003.
Core Java Introduction Byju Veedu Ness Technologies httpdownload.oracle.com/javase/tutorial/getStarted/intro/definition.html.
1. An Introduction A Programming Language A Technology Java Development Kit Java API One Language: Three Editions Standard Edition Enterprise Edition.
Java -- A very Hot Object- Oriented Language Instructors: Fu-Chiung Cheng ( 鄭福炯 ) Associate Professor Computer Science & Engineering Tatung Institute of.
© 2012 Pearson Education, Inc. All rights reserved types of Java programs Application – Stand-alone program (run without a web browser) – Relaxed.
ITP 109 Week 2 Trina Gregory Introduction to Java.
Introduction to Programming 1 1 2Introduction to Java.
20-753: Fundamentals of Web Programming Copyright © 1999, Carnegie Mellon. All Rights Reserved. 1 Lecture 15: Java Basics Fundamentals of Web Programming.
SESSION 1 Introduction in Java. Objectives Introduce classes and objects Starting with Java Introduce JDK Writing a simple Java program Using comments.
CSE S. Tanimoto Java Introduction 1 Java A Programming Language for Web-based Computing.
 It is a pure oops language and a high level language.  It was developed at sun microsystems by James Gosling.
Sung-Dong Kim, Dept. of Computer Engineering, Hansung University Java - Introduction.
Fundamental of Java Programming (630002) Unit – 1 Introduction to Java.
Applications Active Web Documents Active Web Documents.
Object Oriented Programming in
Java™ 2 Platform Getting Started.
A Programming Language for Web-based Computing with Graphics
Chapter 1 Introduction to Computers, Programs, and Java
Introduction Enosis Learning.
Introduction Enosis Learning.
Java Applets.
From C++ to Java Java history: Oak, toaster-ovens, internet language, panacea What it is O-O language, not a hybrid (cf. C++) compiled to byte-code, executed.
A Programming Language for
(Computer fundamental Lab)
Java History, Editions, Version Features
Introducing Java.
Chap 1. Getting Started Objectives
A Programming Language for
Outcome of the Lecture Upon completion of this lecture you will be able to understand Fundamentals and Characteristics of Java Language Basic Terminology.
Presentation transcript:

Introduction to JAVA Vijayan Sugumaran School of Business Administration Oakland University Rochester, MI 48309

Introduction to JAVA n Ancestor to JAVA - Oak –small, robust, architecture independent, Object- Oriented, language to control interactive TV. –didn’t go anywhere –refocused for Internet, Java was born. n JAVA is both compiled and interpreted language. JAVA Source Code Compiled JAVA byte-code UNIX PC MAC

Java Introduction (contd.) n JAVA byte-code (or J-code) is executed by JAVA run- time interpreter (JAVA compliant Virtual Machine) n The interpreter can be run as a separate application or embedded in another software such as a browser. n The fundamental unit of JAVA code is the “class.” n Since JAVA interpreter runs compiled byte-code, JAVA is relatively a fast interpreted language. n The run-time system can compile byte-code to native machine code on the fly to optimize performance. This is called “Just in time.” (one sticky problem is the array- bounds checking)

Java and Javascript n Don’t confuse JAVA with Javascript –Javascript is an object-based scripting language developed by Netscape –Lets you create active user interface and capture and validate user inputs –Client-side replacement for cgi-script, client side computing instead of server side –Java is full-featured programming language –Javascript can interact with Java applets

Java Characteristics n Unlike C++, Java doesn’t allow programmer defined operator overloading n Java doesn’t have a preprocessor, so it doesn’t have macros, #define statements, or conditional source compilation n Java provides a well-defined package structure for organizing class files n Supports only single inheritance class hierarchy, but allows multiple inheritance of Interfaces n -Interface of a class--like an abstract class in C++ which specifies the behavior of an object without defining its implementation

Java Characteristics (contd.) n Statistically typed –data types etched in stone for the compiler (C, C++) n Dynamically typed –type checking performed during execution (lisp or smalltalk) n Early binding –binding method calls to definitions at compile time (C, C++) n Late binding –locating definitions of methods dynamically at run time n Java is statistically typed and late-binding language n Java carries all data-type and method-signature information with it from its source code to its compiled byte-code form

Java Characteristics (contd.) n Base class in Java can evolve with out affecting derived classes as long as it maintains a valid form of its original structure. (in C++, if the base class changes, the derived classes should be recompiled) n Java handles garbage collection n Java uses “references” instead of pointers. Can’t do pointer arithmetic with references. A references is a strongly typed handle for an object. All objects are accessed through references n Security manager controls access to system resources like the file system, network parts, windowing environment, etc.

JAVA Security System Resources Security Manager Class Loader Verifier Untrusted Source JAVA Binary

Safety Implementation n Verifier guarantees the integrity of incoming classes n Verifier: –reads byte-code & makes sure it behaves properly –it is a type of theorem prover - steps through the byte-code and determines the behavior n Class Loader handles loading classes from the network and protects basic system classes n Class Loaders and security managers are implemented by applications that load applets such as browser and applet viewer

More about Class Loader n Class Loader: –Java adds second layer of security with class loader –It brings in Java binary classes that contain byte- code into the interpreter –Classes loaded remain associated with class loader –If a class references another class, the request is served by its original class loader –Classes loaded from one location can be restricted to interact with only those classed loaded from that same location

Security Manager n Security Manager : –Application level security decisions –Security manager is consulted every time the application tries to access system resources –The security manager can be simple or complex as the application warrants –The integrity of the security manager is based on the protection afforded by the lower levels of the Java security model

Java Applets n Applets: –Small embeddable application –A Java applet is a compiled Java program, consisting of classes just like any other Java program –Applets are autonomous programs confined within the walls of the browser or applet viewer. Can interact with user and communicate with the host over the network

Error Handling n The protection of references is one of the most fundamental aspects of Java Security n Java code has to play by the rules--it can’t peek into places it shouldn’t n Error Handling: –Exceptions allow separation of error-handling code from normal code –Exception carries with it an object that contains information about the situation that caused its exception

Multi Threading n Thread –flow of control within a program –threads run in the same address space –share instance variables, but not local variables n Multi Threading: –Threads provide efficient multi processing and distribution of tasks –Threads need to be synchronized--only one synchronized method within the object may run at a given time

Java Packages n Scalability: –Package--structure that groups classes into functional units –Within a package, a class is publicly visible or protected from outside access –Package promote reuse & scalability –Package names constructed in a hierarchical way using dot-separated naming convention »e.g. Java.awt.event

Sample Java Program //Create a file called Welcome.java public class Welcome { public static void main(String[] args) { System.out.println(“Hello World, Welcome to Java!!”); } Compiling and Executing javac Welcome.java (creates Welcome.class - java bytecode) java Welcome (JVM executes the byte code)

Sample Applet //create a file called HelloWeb.java public class HelloWeb extends java.applet.Applet { public void paint( java.awt.Graphics gc) { gc.drawString (“Hello World, Welcome to Java”, 125, 95); }  Compile the java source file (using JDK): javac HelloWeb.java  Create an html file that embeds the applet using the tag  Load the html page into a java supported browser

Sample HTML Document  Save it as HelloWeb.html  Open HelloWeb.html using the browser