Identifiers. Identifiers are the words a programmer uses in a program Some identifiers are already defined. Some are made up by the programmer:

Similar documents
Chapter 1. Introduction

Objectives. Problem Solving. Introduction. An overview of object-oriented concepts. Programming and programming languages An introduction to Java

Chapter. Focus of the Course. Object-Oriented Software Development. program design, implementation, and testing

COMP 202 Java in one week

A PROGRAM IS A SEQUENCE of instructions that a computer can execute to

For the course, we will be using JCreator as the IDE (Integrated Development Environment).

COMP 202 Java in one week

Computer Hardware. Java Software Solutions Lewis & Loftus. Key Hardware Components 12/17/2013

12/22/11. Java How to Program, 9/e. Help you get started with Eclipse and NetBeans integrated development environments.

2 rd class Department of Programming. OOP with Java Programming

Introduction to OOP Using Java Pearson Education, Inc. All rights reserved.

Full file at

Lab # 2. For today s lab:

Basic Programming Language Syntax

Chapter 2: Programming Concepts

COMP 202. Java in one week

Review Chapters 1 to 4. Instructor: Scott Kristjanson CMPT 125/125 SFU Burnaby, Fall 2013

Java Puzzle Ball Nick Ristuccia

Objects and Classes Lecture 1

Objectives. Chapter 2: Basic Elements of C++ Introduction. Objectives (cont d.) A C++ Program (cont d.) A C++ Program

Chapter 2: Basic Elements of C++

CS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 3: SEP. 13TH INSTRUCTOR: JIAYIN WANG

Chapter 2: Basic Elements of C++ Objectives. Objectives (cont d.) A C++ Program. Introduction

Supplement D: Expanded Guidelines on Programming Style and Documentation

SKILL AREA 304: Review Programming Language Concept. Computer Programming (YPG)

ECE 122 Engineering Problem Solving with Java

CompSci 125 Lecture 02

Introduction to Java. Java Programs Classes, Methods, and Statements Comments Strings Escape Sequences Identifiers Keywords

Introduction to Java Chapters 1 and 2 The Java Language Section 1.1 Data & Expressions Sections

Mobile App:IT. Methods & Classes

Creating a C++ Program

Chapter 2 Author Notes

Computational Expression

CS 152: Data Structures with Java Hello World with the IntelliJ IDE

Fundamentals of Programming INTRODUCTION

Assoc. Prof. Dr. Marenglen Biba. (C) 2010 Pearson Education, Inc. All rights reserved.

UEE1302 (1102) F10: Introduction to Computers and Programming

Objectives. In this chapter, you will:

Overview. - General Data Types - Categories of Words. - Define Before Use. - The Three S s. - End of Statement - My First Program

Intro to Programming. Unit 7. What is Programming? What is Programming? Intro to Programming

CS 177 Recitation. Week 1 Intro to Java

COMP 110 Prasun Dewan 1

Programming with Java

II. Compiling and launching from Command-Line, IDE A simple JAVA program

COMP 110 Project 1 Programming Project Warm-Up Exercise

IT 374 C# and Applications/ IT695 C# Data Structures

Lesson 1A - First Java Program HELLO WORLD With DEBUGGING examples. By John B. Owen All rights reserved 2011, revised 2015

Fundamentals of Programming. By Budditha Hettige

Introduction to Java Applications; Input/Output and Operators

Expanded Guidelines on Programming Style and Documentation

Module 1: Introduction to Computers, Programs, and Java

PROGRAM READABILITY. A program's readability readability, which is a measure of how

CPS109 Computer Science 1

Introduction to Algorithms and Data Structures

Sir Muhammad Naveed. Arslan Ahmed Shaad ( ) Muhammad Bilal ( )

Chapter 2, Part I Introduction to C Programming

Wentworth Institute of Technology. Engineering & Technology WIT COMP1000. Java Basics

Assignment Marking Criteria

Lecture 1 - Introduction (Class Notes)

The Programming Process Summer 2010 Margaret Reid-Miller

C++ Spring Break Packet 11 The Java Programming Language

Chapter 3 Syntax, Errors, and Debugging. Fundamentals of Java

COSC 123 Computer Creativity. Introduction to Java. Dr. Ramon Lawrence University of British Columbia Okanagan

printf( Please enter another number: ); scanf( %d, &num2);

Course Outline. Introduction to java

Introduction to Visual Basic and Visual C++ Introduction to Java. JDK Editions. Overview. Lesson 13. Overview

AP Computer Science A: Java Programming

Introduction. Introduction to OOP with Java. Lecture 01: Introduction to OOP with Java - AKF Sep AbuKhleiF -

MEAP Edition Manning Early Access Program Get Programming with Java Version 1

Introduction to Java. Liang, Introduction to Java Programming, Ninth Edition, (c) 2013 Pearson Education, Inc. All rights reserved.

Introduction to OOP with Java. Instructor: AbuKhleif, Mohammad Noor Sep 2017

Chapter 1: A First Program Using C#

Visual Basic 2008 The programming part

Object Declaration. <class name>: the name of the class to which the object belongs <object name>: the name of the object (any valid identifier)

Lesson 2: First Java Programs

Chapter 2 First Java Programs

Introduction to JAVA Programming Language

Week 2: Data and Output

Perl Basics. Structure, Style, and Documentation

2.8. Decision Making: Equality and Relational Operators

Introduction to Java Programming

Java Programming. Zheng-Liang Lu. Java 301 Summer Department of Computer Science & Information Engineering National Taiwan University

Introduction to Software Development (ISD) David Weston and Igor Razgon

Introduction to Java. Lecture 1 COP 3252 Summer May 16, 2017

Topic 1: Programming concepts

An Introduction to Software Engineering. David Greenstein Monta Vista High School

Introduction to Java Applications

Chapter 1 Introduction to Computers, Programs, and Java

Programming Language. Machine Code. CS200: Computer Science I. Module 3 Programming Languages

CS 351 Design of Large Programs Coding Standards

CS 251 Intermediate Programming Coding Standards

Computer Components. Software{ User Programs. Operating System. Hardware

COMP-202: Foundations of Programming. Lecture 2: Java basics and our first Java program! Jackie Cheung, Winter 2016

CS102 Unit 2. Sets and Mathematical Formalism Programming Languages and Simple Program Execution

B.V. Patel Institute of BMC & IT, UTU 2014

Program Abstractions, Language Paradigms. CS152. Chris Pollett. Aug. 27, 2008.

Stating the obvious, people and computers do not speak the same language.

Definite Loops. Computer Science S-111 Harvard University David G. Sullivan, Ph.D. Using a Variable for Counting

C H A P T E R 1. Introduction to Computers and Programming

Tutorial 1 CSC 201. Java Programming Concepts عؾادئماظربجمةمبادؿكدامماجلاصا

Transcription:

C1 D6 Obj: cont. 1.3 and 1.4, to become familiar with identifiers and to understand how programming languages work HW: p.51 #1.8 1.9 (Short Answers) Chapter 1 Test in two class days!! Do Now: How is the program on p.33 different from the program on p.27? (on Document Camera) 1

Identifiers Identifiers are the words a programmer uses in a program Some identifiers are already defined Ex: class, public, static, void, main, println, String, Some are made up by the programmer: Ex: Lincoln 2

An identifier can be made up of letters, digits, the underscore character ( _ ), and the dollar sign Identifiers cannot begin with a digit Java is case sensitive - Total, total, and TOTAL are different identifiers By convention, Java programmers use different case styles for different types of identifiers, such as title case for class names - Lincoln upper case for constants - MAXIMUM 3

Identifiers Sometimes we choose identifiers ourselves when writing a program (such as Lincoln) Sometimes we are using another programmer's code, so we use the identifiers that they chose (such as println) 4

Often we use special identifiers called reserved words that already have a predefined meaning in the language A reserved word cannot be used in any other way 5

Reserved Words The Java reserved words are listed in your text on p.31 You do not need to memorize this list, but you should know whether or not a word is on this list. For example, you should know that you cannot use the word while other than for it s pre-defined use. 6

7

White Space Spaces, blank lines, and tabs are called white space White space is used to separate words and symbols in a program Extra white space is ignored A valid Java program can be formatted in many ways 8

Programs should be formatted to enhance readability, using consistent indentation See Lincoln2.java (page 33) See Lincoln3.java (page 34) These are both the same exact program as on p.27, but they are more difficult for a human to read. 9

Language Levels There are four programming language levels: machine language assembly language high-level language (ex: Java, understandable by programmers) 10

11

Each type of CPU has its own specific machine language The other levels were created to make it easier for a human being to read and write programs 12

Programming Languages A program must be translated into machine language before it can be executed on a particular type of CPU This can be accomplished in several ways A compiler is a software tool which translates source code into a specific target language 13

Eclipse, our editor, is actually an IDE (Integrated Development Environment) It combines an editor, a compiler, and other Java support tools. Other examples of IDEs are NetBeans and JCreator. 14

Java Translation Java source code Java bytecode Java Compiler (ex: Eclipse) Java interpreter Bytecode compiler Machine code 15

Syntax and Semantics The syntax rules of a language define how we can put together symbols, reserved words, and identifiers to make a valid program The semantics of a program statement define what that statement means (its purpose or role in a program) 16

A program that is syntactically correct is not necessarily logically (semantically) correct A program will always do what we tell it to do, not what we meant to tell it to do 17

Errors A program can have three types of errors The compiler will find syntax errors and other basic problems (compile-time errors) If compile-time errors exist, an executable version of the program is not created 18

A problem can occur during program execution, such as trying to divide by zero, which causes a program to terminate abnormally (run-time errors) A program may run, but produce incorrect results, perhaps using an incorrect formula (logical errors) 19

Basic Program Development Edit and save program errors errors Compile program Execute program and evaluate results 20

If time: Finish programming exercises 1.1 1.6! 21