Introducing Java.

Slides:



Advertisements
Similar presentations
1 Copyright © 2005, Oracle. All rights reserved. Introducing the Java and Oracle Platforms.
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.
Programming with Java © 2002 The McGraw-Hill Companies, Inc. All rights reserved. 1 McGraw-Hill/Irwin Chapter 1 Introducing Java.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2005 Pearson Education, Inc. All rights reserved Chapter 1 Introduction to.
Object Orientated Programming
got ? Research Project – April 1998 Hang Xia, Mark Wang, Richard S. Chang Updated: R Norman, August 1999.
IC211 Object Oriented Programming Overview of Java.
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.
Introduction to Java Programming, 4E
Introduction to Java Programming
Created by Ron Beglieter (based on the Java Tutorial) 1 What is Java? Java technology is both a programming language and a platform; Programming Language.
Object-oriented Programming Concepts
For more Lectures and Notes Visit
01 Introduction to Java Technology. 2 Contents History of Java What is Java? Java Platforms Java Virtual Machine (JVM) Java Development Kit (JDK) Benefits.
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.
BASIC JAVA PROGRAMMING TUTORIAL. History  James Gosling and Sun Microsystems  Oak  Java, May 20, 1995, Sun World  Hot Java –The first Java-enabled.
Lecture 1 Introduction to Java MIT- AITI 2004 What is a Computer Program? For a computer to be able to do anything (multiply, play a song, run a word.
+ Java vs. Javascript Jessi Style. + Java Compiled Can stand on its own Written once, run anywhere Two-stage debugging Java is an Object Oriented Programming.
S.W. Ma/CIM/LWL41211/2 Prog. IIA Page 1 HKIVE (Lee Wai Lee Campus) Department of CIM Course : Year 2 Module : Programming IIA Textbook : Introduction.
CSCI 224 Introduction to Java Programming. Course Objectives  Learn the Java programming language: Syntax, Idioms Patterns, Styles  Become comfortable.
Java Workshop for Teachers May 6, 2005 A Brief Look at the Java Programming Language.
Advanced Java New York University School of Continuing and Professional Studies.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved Programming Languages Machine.
CSCI 115 Computer Programming Overview. Computer Software System Software –Operating systems –Utility programs –Language compilers Application Software.
Java Introduction Lecture 1. Java Powerful, object-oriented language Free SDK and many resources at
1 Java Inheritance. 2 Inheritance On the surface, inheritance is a code re-use issue. –we can extend code that is already written in a manageable manner.
Introduction to Java Programming. History F James Gosling and Sun Microsystems F Oak F Java, May 20, 1995, Sun World F HotJava –The first Java-enabled.
1.  At the end of this slide, student can:  Explore tools, features, properties and interface of the Textpad.  Creating a new project.  Open and run.
Lecture 1 Introduction to Java MIT-AITI Ethiopia 2004.
1 Module Objective & Outline Module Objective: After completing this Module, you will be able to, appreciate java as a programming language, write java.
Chapter 1: Introducing JAVA. 2 Introduction Why JAVA Applets and Server Side Programming Very rich GUI libraries Portability (machine independence) A.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved Chapter 1 Introduction to.
© 2012 Pearson Education, Inc. All rights reserved. 1-1 Why Java? Needed program portability – Program written in a language that would run on various.
POS 406 Java Technology And Beginning Java Code
Introduction to Java Programming with Forte Y. Daniel Liang.
JAVA BASICS Prepared by The Smartpath Information Systems
Introduction to Java Programming. Introduction Course Objectives Organization of the Book.
What Is Java? According to Sun in a white paper: Java: A simple, object-oriented, network-savvy, interpreted, robust, secure, architecture-neutral, portable,
Chapter 1: Introducing JAVA. 2 Introduction Why JAVA Applets and web applications Very rich GUI libraries Portability (machine independence) A real Object.
Core Java Introduction Byju Veedu Ness Technologies httpdownload.oracle.com/javase/tutorial/getStarted/intro/definition.html.
Introduction to Java Programming. 2 Chapter 1 Introduction to Java and Forte F What Is Java? F Getting Started With Java Programming –Create, Compile.
Java Programming, Second Edition Chapter Twelve Advanced Inheritance Concepts.
Java Programming: Advanced Topics1 Introduction to Advanced Java Programming Chapter 1.
CSCI 115 Computer Programming Overview. Computer Software System Software –Operating systems –Utility programs –Language compilers Application Software.
Lesson 1 1 LESSON 1 l Background information l Introduction to Java Introduction and a Taste of Java.
1 Introduction to Java. 2 * 10% Assignments/ class participation * 10% Pop Quizzes * 05% Attendance * 25% Mid Term * 50% Final Term.
Introduction to JAVA Programming
Introduction to Java Programming, 4E Y. Daniel Liang.
SESSION 1 Introduction in Java. Objectives Introduce classes and objects Starting with Java Introduce JDK Writing a simple Java program Using comments.
Sung-Dong Kim, Dept. of Computer Engineering, Hansung University Java - Introduction.
Fundamental of Java Programming (630002) Unit – 1 Introduction to Java.
Object Oriented Programming in
Object-Oriented Programming
JAVA By Waqas.
Chapter 1 Introduction to Computers, Programs, and Java
Introduction to Advanced Java Programming
Introduction Enosis Learning.
Introduction Enosis Learning.
Chapter 1 Introduction to Computers, Programs, and Java
Interfaces.
Java Applets.
(Computer fundamental Lab)
Java History, Editions, Version Features
By Rajanikanth B Overview Of Java By Rajanikanth B
Chap 1. Getting Started Objectives
G6DICP - Lecture 27 Java Applets.
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:

Introducing Java

What is Java? Sun defines Java as a: “…simple, object-oriented, network savvy, interpreted, robust, secure, architecture-neutral, portable, high-performance, multi-threaded, dynamic language.”

What is Java? Program cycle Source code is written by the programmer .java extension Compiler converts into bytecodes .class extension Instructions for the JRE Initial class is loaded Statements are interpreted one bytecode at a time Bytecodes may be compiled into platform native instructions Additional classes are loaded as needed

What is Java? History of Java First started in 1990 as Sun’s Green project Digitally controlled consumer devices identified as trend Trend did not grow as expected 1994 – WWW popularity Netscape packaged Java within browser MS Explorer followed suit Success ultimately depended on e-commerce

Development Tools 1995 – First JDK released by Sun (1.0) Very limited JDK 1.1 released Limited GUI creation 1.2 released Major change – Swing components Java 2 SDK release 1.2 Better known as Java 2 Most current version: 1.5

Development Tools Java 2 Editions Java 2 Platform, Standard Edition Java 2 Platform, Enterprise Edition Java 2 Platform, Micro Edition

Java Programs Applets Servlet Application Java program running within client Web browser Servlet Java program running on a server Can ‘cooperate’ with applet or application Application Standalone program

Sample Java Program package myprojects.demo; import java.io.*; import csci130.*; class Demo { public static void main(String args[]) { double length, width, area; System.out.println(“Rectangle Area Calculator"); System.out.println("Enter the length: "); length = KeyboardReader.readDouble(); System.out.println("Enter the width: "); width = KeyboardReader.readDouble(); area = length * width; System.out.println("The area is: " + area); }

Compiling your code From the command line Running javac Demo.java Java Demo

Object-Oriented Programming Java Programming Object-Oriented Programming

Elements of OOP Objects Classes Messages Interfaces

Why Objects Real world objects all share two things State Behavior A car is Red, a convertible, 4 door Behavior Speeds up, brakes, turns, stops, crashes

Real objects maintain their state using variables Color = red Type = convertible Style = 4door Real objects implement behavior thru methods. Brake Accelerate

What's a message? Objects interact A car even as a very high level object does nothing until it gets a message or direction. To stop a car, the driver must give it the message to break. Another way to think of messages are method calls.

Classes Classes are prototypes or blueprints for objects. Classes contain the definitions for the variables and methods common to all objects of a certain kind.

Objects vs Classes The code for that file goes into the java file. car.java When compiled the template is in a class file car.class When talking about a program a class refers to a type of object. When instantiated, it becomes an object. It can become very confusing at times because the terms are often used loosely.

Inheritance Inheritance provides for a powerful mechanism allowing for organizing and structuring software. Inheritance provides for classes to be defined in terms of other classes The relationship between superclasses and subclasses is a “is a” relationship. Dog class Bull_Dog class --- a Bull dog “is a” dog. Subclasses inherit state (variables) and behavior (methods) from the superclass. Inheritance is hierarchical – it can be several layers

Inheritance Classes can inherit from only one superclass Other languages allow for multiple inheritance Java does not Subclasses inherit everything from all superclasses The base class of all classes in Java is the Object Class, every class/ object extends from it. This class has several methods one we will get used to is called the toString(). The result is any class, no matter how many times removed will have the toString().

Interfaces Since Java does not allow multiple inheritance what happens when you want methods from two different classes? Java provides a device called an interface. An Interface is a system that allows entities to interact. An Interface is a collection of methods and constant declarations. When a class implements an Interface, it must write implement all the methods of the interface

Benefits of OOP Modularity Information hiding Source code can be written and maintained for an object independent of the code for other objects. Information hiding An object has a public interface through which it can communitcate with other objects, but can also maintain private information that other objects cannot access. Encapsulation – allows a way to protect how things happen using several layers of access control.

Summary A class is a prototype for objects Objects are created from classes An Object's class is it's type. Objects have varibles and methods as defined in the class. Classes can inherit from other classes Classes an implement interfaces allowing two classes to have similar methods.