JAVA: An Introduction to Problem Solving & Programming, 6 th Ed. By Walter Savitch ISBN 0132162709 © 2012 Pearson Education, Inc., Upper Saddle River,

Slides:



Advertisements
Similar presentations
Designing a Program & the Java Programming Language
Advertisements

In Review JAVA C++ GUIs - Windows Webopedia.com.
INTRODUCTION Chapter 1 1. Java CPSC 1100 University of Tennessee at Chattanooga 2  Difference between Visual Logic & Java  Lots  Visual Logic Flowcharts.
CSCE 145: Algorithmic Design I Chapter 1 Intro to Computers and Java Muhammad Nazmus Sakib.
Introduction to Computers and Java Module 1. Objectives overview computer hardware and software introduce program design and object-oriented programming.
Slides prepared by Rose Williams, Binghamton University Chapter 1 Getting Started 1.1 Introduction to Java.
1 Fall 2008ACS-1903 Chapter 1 Topics Java History Java Programs Why Program? Computer Systems: Hardware and Software Programming Languages What Is a Program.
Chapter 11 Introduction to Computers and Java Chapter 1.
Introduction to Java Programming, 4E
JAVA: An Introduction to Problem Solving & Programming, 5 th Ed. By Walter Savitch and Frank M. Carrano. ISBN © 2009 Pearson Education, Inc.,
JAVA: An Introduction to Problem Solving & Programming, 5 th Ed. By Walter Savitch and Frank M. Carrano. ISBN © 2007 Pearson Education, Inc.,
Introduction to Programming with Java, for Beginners Machine vs. Programming Language Intro to Java Edit-Compile-Run Program Process.
LESSON 1 INTRODUCTION Compiled By: Edwin O. Okech [Tutor, Amoud University] JAVA PROGRAMMING.
CMSC 202 Computer Science II for Majors Fall 2009 Introduction.
COMP Computer Basics Yi Hong May 13, 2015.
Introducing Java.
Chapter 1 Coding Introduction.
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
COMP 110 Spring Announcements Computers in class on Friday: Lab Office Hours: Monday 12-2 New students see me after class Administrative Changes.
COMP 110: Introduction to Programming Tyler Johnson January 14, 2009 MWF 11:00AM-12:15PM Sitterson 014.
CMSC 202 Computer Science II for Majors Object-Oriented Programming.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved Programming Languages Machine.
JAVA: An Introduction to Problem Solving & Programming, 5 th Ed. By Walter Savitch and Frank M. Carrano. ISBN © 2007 Pearson Education, Inc.,
JAVA: An Introduction to Problem Solving & Programming, 5 th Ed. By Walter Savitch and Frank Carrano. ISBN © 2008 Pearson Education, Inc., Upper.
1 Chapter 2 First Java Programs Fundamentals of Java: AP Computer Science Essentials, 4th Edition Lambert / Osborne.
JAVA: An Introduction to Problem Solving & Programming, 7 th Ed. By Walter Savitch ISBN © 2015 Pearson Education, Inc., Upper Saddle River,
Introduction to Computers and Java Chapter 1.3. A Sip of Java: Outline History of the Java Language Applets A First Java Program Compiling a Java Program.
1 Introduction to Java Brief history of Java Sample Java Program Compiling & Executing Reading: => Section 1.1.
JAVA: An Introduction to Problem Solving & Programming, 5 th Ed. By Walter Savitch and Frank Carrano. ISBN © 2009 Pearson Education, Inc., Upper.
Introduction to Computers & Java CSS 161: Fundamentals of Computing Joe McCarthy 1.
CSS 161 Fundamentals of Computing Introduction to Computers & Java September 26, 2012 CSS 161: Fundamentals of Computing Instructor: Uma Murthy CSS SKL.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved Chapter 1 Introduction to.
Jaeki Song ISQS6337 JAVA Lecture 03 Introduction to Java -The First Java Application-
© 2012 Pearson Education, Inc. All rights reserved. 1-1 Why Java? Needed program portability – Program written in a language that would run on various.
Chapter 1: Introduction to Programs, and Java 1. Objectives To review programs (§ ). To understand the relationship between Java and the World Wide.
CHAPTER 1 Introduction to Computers and Java Copyright © 2016 Pearson Education, Inc., Hoboken NJ.
Introduction to Java Programming with Forte Y. Daniel Liang.
CSS 161 Fundamentals of Computing Introduction to Computers & Java Joe McCarthy CSS 161: Fundamentals of Computing.
Chapter 11 Introduction to Computers and Java Chapter 1.
JAVA: An Introduction to Problem Solving & Programming, 5 th Ed. By Walter Savitch and Frank Carrano. ISBN © 2009 Pearson Education, Inc., Upper.
Chapter 1 Section 1.1 Introduction to Java Slides prepared by Rose Williams, Binghamton University Kenrick Mock, University of Alaska Anchorage.
Introduction to Computers and Java Module 1. Objectives overview computer hardware and software introduce program design and object-oriented programming.
JAVA: An Introduction to Problem Solving & Programming, 7 th Ed. By Walter Savitch ISBN © 2015 Pearson Education, Inc., Upper Saddle River,
JAVA: An Introduction to Problem Solving & Programming, 6 th Ed. By Walter Savitch ISBN © 2012 Pearson Education, Inc., Upper Saddle River,
Application Architecture Using Java Hong Li. Introduction Developed by a team led by James Gosling at Sun Microsystem. Originally called Oak, designed.
© 2012 Pearson Education, Inc. All rights reserved types of Java programs Application – Stand-alone program (run without a web browser) – Relaxed.
Today… “Hello World” ritual. Brief History of Java & How Java Works. Introduction to Java class structure. But first, next slide shows Java is No. 1 programming.
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: An Introduction to Problem Solving & Programming, 7 th Ed. By Walter Savitch ISBN © 2015 Pearson Education, Inc., Upper Saddle River,
©2016 Pearson Education, Inc. Upper Saddle River, NJ. All Rights Reserved. CSC 110 – INTRO TO COMPUTING - PROGRAMMING Overview of Programming.
JAVA: An Introduction to Problem Solving & Programming, 6 th Ed. By Walter Savitch ISBN © 2012 Pearson Education, Inc., Upper Saddle River,
JAVA: An Introduction to Problem Solving & Programming, 7 th Ed. By Walter Savitch ISBN © 2015 Pearson Education, Inc., Upper Saddle River,
JAVA: An Introduction to Problem Solving & Programming, 7 th Ed. By Walter Savitch ISBN © 2015 Pearson Education, Inc., Upper Saddle River,
JAVA: An Introduction to Problem Solving & Programming, 6 th Ed. By Walter Savitch ISBN © 2012 Pearson Education, Inc., Upper Saddle River,
Introduction to JAVA Programming
Programs and Models Almost all computer programs model some artifact – Artifact: product of civilization, either concrete or abstract, simple or complex.
Introduction to Java Programming, 4E Y. Daniel Liang.
JAVA: An Introduction to Problem Solving & Programming, 6 th Ed. By Walter Savitch ISBN © 2012 Pearson Education, Inc., Upper Saddle River,
Fundamental of Java Programming (630002) Unit – 1 Introduction to Java.
Introduction to Algorithm. What is Algorithm? an algorithm is any well-defined computational procedure that takes some value, or set of values, as input.
Java programming lecture one
Introduction to Computers and Java
Chapter 1 Introduction to Computers, Programs, and Java
Introduction to Computers and Java
Mobile Development Workshop
Introduction to Computers and Java
Introduction to Java Brief history of Java Sample Java Program
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:

JAVA: An Introduction to Problem Solving & Programming, 6 th Ed. By Walter Savitch ISBN © 2012 Pearson Education, Inc., Upper Saddle River, NJ. All Rights Reserved Section 1.3 A Sip of Java: Outline History of the Java Language Applications and Applets A First Java Application Program Writing, Compiling, and Running a Java Program

JAVA: An Introduction to Problem Solving & Programming, 6 th Ed. By Walter Savitch ISBN © 2012 Pearson Education, Inc., Upper Saddle River, NJ. All Rights Reserved History of Java In 1991, James Gosling and Sun Microsystems began designing a language for home appliances (toasters, TVs, etc.).  Challenging, because home appliances are controlled by many different chips (processors)  Programs were translated first into an intermediate language common to all appliance processors.

JAVA: An Introduction to Problem Solving & Programming, 6 th Ed. By Walter Savitch ISBN © 2012 Pearson Education, Inc., Upper Saddle River, NJ. All Rights Reserved History of Java  Then the intermediate language was translated into the machine language for a particular appliance’s processor.  Appliance manufacturers weren’t impressed. In 1994, Gosling realized that his language would be ideal for a Web browser that could run programs over the Internet.  Sun produced the browser known today as HotJava.

JAVA: An Introduction to Problem Solving & Programming, 6 th Ed. By Walter Savitch ISBN © 2012 Pearson Education, Inc., Upper Saddle River, NJ. All Rights Reserved Applications and Applets Two kinds of java programs: applications and applets Applications  Regular programs  Meant to be run on your computer Applets  Little applications  Meant to be sent to another location on the internet and run there

JAVA: An Introduction to Problem Solving & Programming, 6 th Ed. By Walter Savitch ISBN © 2012 Pearson Education, Inc., Upper Saddle River, NJ. All Rights Reserved A First Java Application View sample program Listing 1.1sample program  class FirstProgram

JAVA: An Introduction to Problem Solving & Programming, 6 th Ed. By Walter Savitch ISBN © 2012 Pearson Education, Inc., Upper Saddle River, NJ. All Rights Reserved [In Mac OS X Terminal window] 6 d :Code joe$ ls FirstProgram* FirstProgram.java d :Code joe$ javac FirstProgram.java d :Code joe$ ls FirstProgram* FirstProgram.classFirstProgram.java d :Code joe$ java FirstProgram Hello reader. Welcome to Java. Let's demonstrate a simple calculation. 2 plus 2 is 4 d :Code joe$ Program [only] computes = 4. How can we make this more general?

JAVA: An Introduction to Problem Solving & Programming, 6 th Ed. By Walter Savitch ISBN © 2012 Pearson Education, Inc., Upper Saddle River, NJ. All Rights Reserved

Java Programs 8

JAVA: An Introduction to Problem Solving & Programming, 6 th Ed. By Walter Savitch ISBN © 2012 Pearson Education, Inc., Upper Saddle River, NJ. All Rights Reserved Some Terminology The person who writes a program is called the programmer. The person who interacts with the program is called the user. A package is a library of classes that have been defined already.  import java.util.Scanner;

JAVA: An Introduction to Problem Solving & Programming, 6 th Ed. By Walter Savitch ISBN © 2012 Pearson Education, Inc., Upper Saddle River, NJ. All Rights Reserved Some Terminology The item(s) inside parentheses are called argument(s) and provide the information needed by methods. A variable is something that can store data. An instruction to the computer is called a statement; it ends with a semicolon. The grammar rules for a programming language are called the syntax of the language.

JAVA: An Introduction to Problem Solving & Programming, 6 th Ed. By Walter Savitch ISBN © 2012 Pearson Education, Inc., Upper Saddle River, NJ. All Rights Reserved Printing to the Screen System.out is an object for sending output to the screen. println is a method to print whatever is in parentheses to the screen. System.out.println (“Whatever you want to print”);

JAVA: An Introduction to Problem Solving & Programming, 6 th Ed. By Walter Savitch ISBN © 2012 Pearson Education, Inc., Upper Saddle River, NJ. All Rights Reserved Printing to the Screen The object performs an action when you invoke or call one of its methods objectName.methodName(argumentsTheMethodNeeds);

JAVA: An Introduction to Problem Solving & Programming, 6 th Ed. By Walter Savitch ISBN © 2012 Pearson Education, Inc., Upper Saddle River, NJ. All Rights Reserved Compiling a Java Program or Class A Java program consists of one or more classes, which must be compiled before running the program. You need not compile classes that accompany Java (e.g. System and Scanner ). Each class should be in a separate file. The name of the file should be the same as the name of the class.

JAVA: An Introduction to Problem Solving & Programming, 6 th Ed. By Walter Savitch ISBN © 2012 Pearson Education, Inc., Upper Saddle River, NJ. All Rights Reserved Java Goal:  Write once, run anywhere  JDK: Java Developers Kit  JRE: Java Runtime Environment Editions  SE: Standard Edition  EE: Enterprise Edition  ME: Micro Edition (mobile, embedded)  Embedded: flash memory, closed systems Versions  1.0 (1992), (2006), 1.8 (2014) 14

JAVA: An Introduction to Problem Solving & Programming, 6 th Ed. By Walter Savitch ISBN © 2012 Pearson Education, Inc., Upper Saddle River, NJ. All Rights Reserved Downloading Java [optional]  Current: Version 8 update 40 (1.7u25) On Mac, requires Mac OS X or higher We will be writing (developing) Java code, so we want JDK  Which includes JRE 15

JAVA: An Introduction to Problem Solving & Programming, 6 th Ed. By Walter Savitch ISBN © 2012 Pearson Education, Inc., Upper Saddle River, NJ. All Rights Reserved 16

JAVA: An Introduction to Problem Solving & Programming, 6 th Ed. By Walter Savitch ISBN © 2012 Pearson Education, Inc., Upper Saddle River, NJ. All Rights Reserved Integrated Development Environments (IDEs) Programming tools  Edit text (code) + compile + run  Graphical representations of components We’ll be using BlueJ, but you can use others netbeans.orgeclipse.orgbluej.org 17

JAVA: An Introduction to Problem Solving & Programming, 6 th Ed. By Walter Savitch ISBN © 2012 Pearson Education, Inc., Upper Saddle River, NJ. All Rights Reserved Downloading BlueJ [optional] 18

JAVA: An Introduction to Problem Solving & Programming, 6 th Ed. By Walter Savitch ISBN © 2012 Pearson Education, Inc., Upper Saddle River, NJ. All Rights Reserved Next time (Monday) Get textbook Download Java and BlueJ (if needed) Read:  Java: An Introduction…, (Savitch Notes) Sections  Absolute Java, Section 1.1 and 1.2 Using BlueJ (or other IDE), run sample Java program in display 1.1, FirstProgram Complete Assignment A (Due Saturday) 19