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.

Slides:



Advertisements
Similar presentations
L1-2:CSC ©Dr. Basheer M. Nasef Lecture #1 By Dr. Basheer M. Nasef.
Advertisements

Liang, Introduction to Java Programming, Sixth Edition, (c) 2005 Pearson Education, Inc. All rights reserved Chapter 1 Introduction to.
Excerpts from Introduction to Java Programming, 4E Author: Y. Daniel Liang (Copyright by Prentice Hall)
Introduction to Java Programming, 4E
 2003 Prentice Hall, Inc. All rights reserved. Customized by Sana Odeh for the use of this class. 1 Introduction to Computers and Programming in JAVA.
1 Chapter 1 Introduction to Computers, Programs, and Java.
Programming Software Applications Week 1 Dr. Xiaohong Gao Trent Park – B107, ext. 2252
1. 2 Chapter 1 Introduction to Computers, Programs, and Java.
Getting Started What is Java? A programming language –Fully buzzword-compliant: A simple, object oriented, distributed, interpreted, robust, secure,
Java Software Solutions Lewis and Loftus Chapter 2 1 Copyright 1997 by John Lewis and William Loftus. All rights reserved. Software Concepts -- Introduction.
BASIC JAVA PROGRAMMING TUTORIAL. History  James Gosling and Sun Microsystems  Oak  Java, May 20, 1995, Sun World  Hot Java –The first Java-enabled.
CTIS251-Week 1 Engineering Software and Java Dr. Ozlem Albayrak.
Introduction to Java Programming with JBuilder 4
+ 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.
Chapter 1 Introduction to Computers, Programs, and Java 1.
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.
LESSON 2 CREATING A JAVA APPLICATION JAVA PROGRAMMING Compiled By: Edwin O. Okech [Tutor, Amoud University]
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved Programming Languages Machine.
Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved Chapter 1 Introduction to Computers,
CPCS  Problem Solving in Everyday Life  Types of Problems  Problem Solving with Computers  Difficulties with Problem Solving 0-3.
1 Chapter 1 Introduction to Computers, Programs, and Java.
Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved Chapter 1 Introduction to Programs,
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.
1 Part I : Chapter 01 Introduction to Java Programming.
1 Module Objective & Outline Module Objective: After completing this Module, you will be able to, appreciate java as a programming language, write java.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved Chapter 1 Introduction to.
1 Chapter 1 Java –Originally for intelligent consumer-electronic devices –Then used for creating Web pages with dynamic content –Now also used for: Develop.
Jaeki Song ISQS6337 JAVA Lecture 03 Introduction to Java -The First Java Application-
Chapter 1: Introduction to Programs, and Java 1. Objectives To review programs (§ ). To understand the relationship between Java and the World Wide.
Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved Chapter 1 Introduction to Programs.
Intro and Review Welcome to Java. Introduction Java application programming Use tools from the JDK to compile and run programs. Videos at
Introduction to Java Programming with Forte Y. Daniel Liang.
1 Programming Fundamentals AITI-GP. 2 Introduction to Programming.
Java Programming, 2E Introductory Concepts and Techniques Chapter 1 An Introduction to Java and Program Design.
Object Oriented Rabie A. Ramadan, PhD Slides are exerted from different sources.
Introduction to Java Programming. Introduction Course Objectives Organization of the Book.
Java Programming Lecture 1 Instructors: Fu-Chiung Cheng ( 鄭福炯 ) Associate Professor Computer Science & Engineering Tatung University
Introduction To JAVA By Ihtesham Ul Haq. Course Objectives Upon completing the course, you will understand Upon completing the course, you will understand.
JAVA PROGRAMMING BASICS CHAPTER 2. History of Java Begin with project Green in 1991 founded by Patrick Noughton, Mike Sheridan and James Gosling who worked.
Using Data Within a Program Chapter 2.  Classes  Methods  Statements  Modifiers  Identifiers.
SOFTWARE TECHNOLOGY - I JAVA/OOP Wickramanayake HMKSK Department of Electrical & Electronic Engineering Faculty of Engineering University.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved Chapter 1 Introduction to.
Introduction to Java Chapter 7 - Classes & Object-oriented Programming1 Chapter 7 Classes and Object-Oriented Programming.
Application Architecture Using Java Hong Li. Introduction Developed by a team led by James Gosling at Sun Microsystem. Originally called Oak, designed.
Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved Chapter 1 Introduction to.
Creating a Java Application and Applet
Introduction to Java Programming. 2 Chapter 1 Introduction to Java and Forte F What Is Java? F Getting Started With Java Programming –Create, Compile.
Object Oriented Programming Object and Classes Lecture 3 MBY.
Object and Classes อ. ยืนยง กันทะเนตร คณะเทคโนโลยีสารสนเทศและการสื่อสาร มหาวิทยาลัยพะเยา Chapter 3.
WEEK 2 1 Software Concepts -- Introduction Now we can begin to examine the basic ideas behind writing programs Chapter 2 focuses on: history.
1 Chapter 1 Introduction to Computers, Programs, and Java.
Liang, Introduction to Java Programming, Ninth Edition, (c) 2013 Pearson Education, Inc. All rights reserved. 1 Chapter 1 Introduction.
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.
 It is a pure oops language and a high level language.  It was developed at sun microsystems by James Gosling.
GC101 Introduction to computer and program
Chapter 1 Introduction to Computers, Programs, and Java
Chapter No. : 1 Introduction to Java.
Chapter 1 Introduction to Computers, Programs, and Java
Statements, Comments & Simple Arithmetic
Introduction to Java.
Chapter 1 Introduction to Computers, Programs, and Java
Anatomy of a Java Program
Lecture Notes - Week 2 Lecture-1. Lecture Notes - Week 2 Lecture-1.
Introducing Java.
Chap 1. Getting Started Objectives
Interfaces,Packages and Threads
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 Programming

History F James Gosling and Sun Microsystems F Oak F Java, May 20, 1995, Sun World F HotJava –The first Java-enabled Web browser F JDK Evolutions F J2SE, J2ME, and J2EE

Characteristics of Java F Java is simple F Java is object-oriented F Java is distributed F Java is interpreted F Java is robust F Java is secure F Java is architecture-neutral F Java is portable F Java’s performance F Java is multithreaded F Java is dynamic

Getting Started with Java Programming F A Simple Java Application F Compiling Programs F Executing Applications

A Simple Application Example 1.1 //This application program prints Welcome //to Java! public class Welcome { public static void main(String[] args) { System.out.println("Welcome to Java!"); }

Creating and Compiling Programs F On command line –javac file.java

Executing Applications F On command line –java classname

Example javac Welcome.java java Welcome output:...

Anatomy of a Java Program F Comments F Package F Reserved words F Modifiers F Statements F Blocks F Classes F Methods F The main method

Comments In Java, comments are preceded by F two slashes (//) in a line, F enclosed between /* and */ in one or multiple lines. F Non executable statement.

Package java.util— collection data structure classes java.io— file operations java.math— multiprecision arithmetics java.nio— the New I/O framework for Java java.net— networking operations, sockets, DNS lookups,... java.security— key generation, encryption and decryption java.sql— Java Database Connectivity (JDBC) to access databases java.awt— basic hierarchy of packages for native GUI components javax.swing— hierarchy of packages for platform-independent rich GUI componentsGUI java.applet— classes for creating an applet

Reserved Words F keywords are words that have a specific meaning to the compiler and cannot be used for other purposes in the program. F class F public F Static F void.

Modifiers Java uses certain reserved words called modifiers that specify the properties of the data, methods, and classes and how they can be used F public, static, private, F final, abstract, protected

Statements A statement represents an action or a sequence of actions. F System.out.println("Welcome to Java!") F "Welcome to Java!“ F Every statement in Java ends with a semicolon (;).

Blocks A pair of braces in a program forms a block that groups components of a program.

Classes F The class is the essential Java construct. F A class is a template or blueprint for objects. F To program in Java, you must understand classes and be able to write and use them. F a program is defined by using one or more classes.

public class Dog { String breed; int age; String color; void barking(){ } void hungry(){ } void sleeping(){ } }

Methods F Is a collection of statements that performs a sequence of operations to display a message on the console. F The string argument is enclosed within parentheses.

Main Method F The main method provides the control of program flow. F The Java interpreter executes the application by invoking the main method. F The main method looks like this: public static void main(String[] args) { // Statements; }

Object F Objects have states and behaviors. Example: A dog has states - color, name, breed as well as behaviors -wagging, barking, eating. An object is an instance of a class. F Creating an Object: F a class provides the blueprints for objects. So basically an object is created from a class. In Java, the new key word is used to create new objects. There are three steps when creating an object from a class: –Declaration: A variable declaration with a variable name with an object type. –Instantiation: The 'new' key word is used to create the object. –Initialization: The 'new' keyword is followed by a call to a constructor. This call initializes the new object.

class Rectangle { double length; double breadth; } class RectangleDemo { public static void main(String args[]) { Rectangle myrect = new Rectangle(); double area; myrect.length = 10; myrect.breadth = 20; area = myrect.length * myrect.breadth ; System.out.println("Area is " + area); }

F C:java>javac RectangleDemo.java F C:java>java RectangleDemo F Area is 200.0