COMP201 Java Programming Topic 1: Introduction Readings: Chapter 1.

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

Portability and Safety Mahdi Milani Fard Dec, 2006 Java.
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
Introduction to Java The objectives of this chapter are: To describe the key aspects of Java To describe the Java software development kit (SDK) To explain.
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.
Java for High Performance Computing Jordi Garcia Almiñana 14 de Octubre de 1998 de la era post-internet.
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.
Chapter 10 Application Development. Chapter Goals Describe the application development process and the role of methodologies, models and tools Compare.
Asst.Prof.Dr.Ahmet Ünveren SPRING Computer Engineering Department Asst.Prof.Dr.Ahmet Ünveren SPRING Computer Engineering Department.
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.
Sadegh Aliakbary Sharif University of Technology Fall 2011.
Suma D Event Driven programming using java(CSE210) Overview of java Packages and interface Exception handling Multithreading Input/output.
JAVA v.s. C++ Programming Language Comparison By LI LU SAMMY CHU By LI LU SAMMY CHU.
CSC 142 A 1 CSC 142 Introduction to Java [Reading: chapter 0]
Java Security. Topics Intro to the Java Sandbox Language Level Security Run Time Security Evolution of Security Sandbox Models The Security Manager.
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 4 Web technologies: HTTP, CGI, PHP,Java applets)
CSCI 224 Introduction to Java Programming. Course Objectives  Learn the Java programming language: Syntax, Idioms Patterns, Styles  Become comfortable.
Introduction to Java Kumar Harshit. Objectives ( 목적지 ) At the end of the lesson, the student should be able to: ● Describe the features of Java technology.
Sadegh Aliakbary Sharif University of Technology Spring 2011.
Sadegh Aliakbary. Copyright ©2014 JAVACUP.IRJAVACUP.IR All rights reserved. Redistribution of JAVACUP contents is not prohibited if JAVACUP.
1 8/29/05CS360 Windows Programming Professor Shereen Khoja.
Sadegh Aliakbary Sharif University of Technology Fall 2010.
Programming Fundamentals 2: Background/ F II Objectives – –give a non-technical overview of Java Semester 2, Background.
An intro to programming. The purpose of writing a program is to solve a problem or take advantage of an opportunity Consists of multiple steps:  Understanding.
Java Introduction Lecture 1. Java Powerful, object-oriented language Free SDK and many resources at
Why Java? A brief introduction to Java and its features Prepared by Mithat Konar.
Sadegh Aliakbary Sharif University of Technology Fall 2012.
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 Java is a programming language and computing platform first released by Sun Microsystems in It was first developed by James Gosling at Sun Microsystems,
Java Security Nathan Moore CS 665. Overview Survey of Java Inherent Security Properties Java Runtime Environment Java Virtual Machine Java Security Model.
COMP201 Java Programming Topic 1: Introduction Readings: Chapter 1.
Introduction and Features of Java. What is java? Developed by Sun Microsystems (James Gosling) A general-purpose object-oriented language Based on C/C++
CS 3131 Introduction to Programming in Java Rich Maclin Computer Science Department.
Introduction to Object Oriented Programming CMSC 331.
Chapter 1 Section 1.1 Introduction to Java Slides prepared by Rose Williams, Binghamton University Kenrick Mock, University of Alaska Anchorage.
What Is Java? According to Sun in a white paper: Java: A simple, object-oriented, network-savvy, interpreted, robust, secure, architecture-neutral, portable,
Lecture 1 Introduction. Instructor Name: Seokwoo Song Office: business 524 Phone: Office Hours: M W 4:30 – 5:30 PM or by appointment
National Taiwan University Department of Computer Science and Information Engineering National Taiwan University Department of Computer Science and Information.
Chapter 2: A Brief History Object- Oriented Programming Presentation slides for Object-Oriented Programming by Yahya Garout KFUPM Information & Computer.
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.
CT1513 Introduction To java © A.AlOsaimi.
1. An Introduction A Programming Language A Technology Java Development Kit Java API One Language: Three Editions Standard Edition Enterprise Edition.
What is Java? Object Oriented Programming Language Sun Microsystems “Write Once, Run Everywhere” Bytecode and Virtual Machine Java Platform (Java VM and.
Introduction Mehdi Einali Advanced Programming in Java 1.
Java – in context Main Features From Sun Microsystems ‘White Paper’
Lesson 1 1 LESSON 1 l Background information l Introduction to Java Introduction and a Taste of Java.
Introduction to Programming 1 1 2Introduction to Java.
JAVA TRAINING IN NOIDA. JAVA Java is a general-purpose computer programming language that is concurrent, class-based, object-oriented and specifically.
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
Done By: Ashlee Lizarraga Ricky Usher Jacinto Roches Eli Gomez
Chapter 1 Introduction to Computers, Programs, and Java
Lecture 1: Introduction to JAVA
Introduction Enosis Learning.
Introduction Enosis Learning.
(Computer fundamental Lab)
Java History, Editions, Version Features
F II 1. Background Objectives
Chap 1. Getting Started Objectives
Chap 4. Programming Fundamentals
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:

COMP201 Java Programming Topic 1: Introduction Readings: Chapter 1

COMP201 Topic 1 / Slide 2 Outline l C, C++, and Java How Java is related to C and C++ l Advantages of Java Writing good codes in Java is easier than in C or C++ l Java libraries (packages) Where the power of Java come from l Java and the internet What Java is good for l Course content

COMP201 Topic 1 / Slide 3 C, C++, and Java l C designed in 1970’s for operating system programming, i.e. UNIX n High-level language compared with assembly language n Low-level compared with C++ or java –Low level = Easy manipulation of hardware –High level = Relying one lower level software to implement task with minimum amount of code. n Strengths –Not restrictive, especially in relation to type conversion. –More efficient than C++ and Java. n Weaknesses: –Not object-oriented: does not support abstraction and encapsulation l Difficult to manage in large projects. –Little built-in functionalities. Programmer need to start from scratch. –Easy to make mistakes. (pointers, a=b vs a==b )

COMP201 Topic 1 / Slide 4 C, C++, and Java l C++ designed in 1980’s, complete superset of C l Changes l Support for Object-Oriented programming l … l Strengths l Improved data abstraction and encapsulation l Makes it easier to manage large projects l More extensive built-ins (standard libraries) l Weakness l Considered by many to be over-complicated l Contains all of C’s problems

COMP201 Topic 1 / Slide 5 C, C++ and Java l Java: a language of 1990’s l The design of Java starts with C syntax and semantics l Adds a few features from C++: Objects, exceptions l Leaves out parts unneeded, unsafe, complex (not backward compatible) Gosling: “Java omits many rarely used, poorly understood, confusing features of C++ that in our experience bring more grief than benefits.” l Adds a few facilities not present in C or C++ Garbage collection, concurrency, runtime error checking, object serialization, interface, inner classes, threads l Strengthens portability and security

COMP201 Topic 1 / Slide 6 C, C++ and Java

COMP201 Topic 1 / Slide 7 Outline l C, C++, and Java How Java is related to C and C++ l Advantages of Java Writing good codes in Java is easier than in C or C++ l Java libraries (packages) Where the power of Java come from l Java and the internet What Java is good for l Course content

COMP201 Topic 1 / Slide 8 Advantages of Java l According to Sun’s Java White paper: “Java is a simple, objected-oriented, distributed, interpreted, robust, secure, architecture-neutral, portable, high-performance, multi-threaded, and dynamic language”. l Most of the claims are justified, while others are controversial.

COMP201 Topic 1 / Slide 9 l Streamlined C language: No typedef, union, enum, goto, comma operator n No header files –C: list.h, list.c –Java: List.java n No makefile –Java compiler can figure out dependencies among classes Advantages of Java/Simple

COMP201 Topic 1 / Slide 10 l Fixed problematic areas: n No pointers, no function pointers n Add garbage collection. Memory leaks no more n No code like this “if (a=b)” does not compile if ( *Head == NULL ){ *Head=(NODESET *) memAllocate(sizeof(NODESET)); *(Head+5) = tmpNode; (*Head)->next=(*Head)->prev=NULL; } memDeallocate( Head ); Advantages of Java/Simple

COMP201 Topic 1 / Slide 11 l Everything is class except several primitive types n Array is a class. Cannot go over bound. –No this l int a[5]; a[5]=0; l However, Java libraries are quite complicated Advantages of Java/Simple

COMP201 Topic 1 / Slide 12 Advantages of Java/Object-Oriented l More so than C++. l Combine data and behavior into one unit, the object l Programs are collections of interacting, cooperating objects l Advantages of OOP l Provide strong data abstraction and encapsulation l Gives framework for design l Allows independent development and testing l Facilitates system extensions and maintenance l More opportunity for code re-use

COMP201 Topic 1 / Slide 13 Advantages of Java/Platform-Independent l C and C++ programs are compiled into object code, n Object code is directly processed by hardware processor. n Require a separate compiler for each computer platform, i.e. for each computer operating system and the hardware set of instructions that it is built on. l Java programs are compiled into bytecode n Bytecode is processed by a program called java virtual machine (JVM), rather than by the "real" computer machine, the hardware processor. n Platform differences dealt with by JVM n Consequently, Java programs can run on any platform. “Write once, run anywhere”.

COMP201 Topic 1 / Slide 14 Java Virtual Machine Java Compiler Java Libraries HotSpot Compiler Class loader bytecode to verifier Runtime System Operating System Hardware Java Source Bytecodes move locally or through net Java bytecode (class) Compile time environment Runtime environment (Java Platform)

COMP201 Topic 1 / Slide 15 Advantages of Java/Robust and Secure l Fewer language loopholes No pointers, typecasts limited. (Easier to produce error free source code) l Compilers are strict Require initialization of variables, enforces type consistency, requires prototypes (Less chance of error in compiled code code) l Runtime error checking Array bounds, null reference access (Less chance of runtime error) l Security manager System to control permissions for high-level actions l Runtime verifier checks untrusted bytecode Avoids havoc from hand-constructed bytecode

COMP201 Topic 1 / Slide 16 In Summary, writing good codes in Java is easier than in C or C++ javadoc generates documentation automatically n Very useful Example: HLCM l Now, I write all my programs in java Advantages of Java

COMP201 Topic 1 / Slide 17 Outline l C, C++, and Java How Java is related to C and C++ l Advantages of Java Writing good codes in Java is easier than in C or C++ l Java libraries (packages) Where the power of Java come from l Java and the internet What Java is good for l Course content

COMP201 Topic 1 / Slide 18 Java Libraries l Java has far expanded traditional scope of a language’s libraries l Java 2 SDK 1.4: l 3,020 classes and interfaces l 32,138 methods l Much less effort required to accomplish common tasks l Platform-specific details are handled l All programs improved when common core updated

COMP201 Topic 1 / Slide 19 Java Libraries l Collection of classes grouped into packages Java equivalent of C libraries l java.lang String, Math, Exception, Thread, Runtime, etc l java.util Vector, Stack, hashtable, Date, Tokenizer l java.io Varieties of input/output processing l java.net Networking, client/server sockets, URLs l java.awt, javax.swing Windows, buttons, drawing, images, events

COMP201 Topic 1 / Slide 20 Java Libraries l java.security Encryption, digital signature, message digest l java.text Formatting and parsing l java.sql Database connectivity l java.rmi Remote method invocation, distributed objects l The list goes on… And it is continuing to expand. Java is still young

COMP201 Topic 1 / Slide 21 Outline l C, C++, and Java How Java is related to C and C++ l Advantages of Java Writing good codes in Java is easier than in C or C++ l Java libraries (packages) Where the power of Java come from l Java and the internet What Java is good for l Course content

COMP201 Topic 1 / Slide 22 Java and the Internet l Java is intended to be used in networked/distributed environments. l Increasingly used for “middleware” to communicate between clients and serves, acting as a universal glue that connect user with information from various sources. Example: JMOL l Made possible by portability and multithreading and networking capabilities. Applet Swing (GUI) Servlet DB Java Networking Remote Method Invocation Client BrowserServer Applet User JDBC

COMP201 Topic 1 / Slide 23 Course Contents l Language Basics: n Classes, objects, inheritance, interface, inner classes, exception, I/O l Components in the following diagram l Other issues n Multithreading, security Applet Swing (GUI) Servlet DB Java Networking Remote Method Invocation Client BrowserServer Applet JDBC User