High-Level Language. Building a Modern Computer From First Principles.

Size: px
Start display at page:

Download "High-Level Language. Building a Modern Computer From First Principles. www.nand2tetris.org"

Transcription

1 High-Level Language Building a Modern Computer From First Principles Elements of Computing Systems, Nisan & Schocken, MIT Press, Chapter 9: High-Level Language slide 1

2 Where we are at: Human Thought Abstract design Chapters 9, 12 abstract interface H.L. Language & Operating Sys. Compiler Chapters abstract interface Virtual Machine Software hierarchy VM Translator Chapters 7-8 abstract interface Assembly Language Assembler Chapter 6 abstract interface Machine Language Computer Architecture Chapters 4-5 Hardware hierarchy abstract interface Hardware Platform Gate Logic Chapters 1-3 abstract interface Chips & Logic Gates Electrical Engineering Physics Elements of Computing Systems, Nisan & Schocken, MIT Press, Chapter 9: High-Level Language slide 2

3 A brief evolution of object-oriented languages Machine language (binary code) Assembly language (low-level symbolic programming) Simple procedural languages, e.g. Fortran, Basic, Pascal, C Simple object-based languages (without inheritance), e.g. early versions of Visual Basic, JavaScript Jack Fancy object-oriented languages (with inheritance): C++, Java, C# Elements of Computing Systems, Nisan & Schocken, MIT Press, Chapter 9: High-Level Language slide 3

4 The Jack programming language Jack: a simple, object-based, high-level language with a Java-like syntax Some sample applications written in Jack: procedural programming Pong game Space Invaders Tetris Elements of Computing Systems, Nisan & Schocken, MIT Press, Chapter 9: High-Level Language slide 4

5 Disclaimer Although Jack is a real programming language, we don t view it as an end Rather, we use Jack as a means for teaching: How to build a compiler How the compiler and the language interface with the operating system How the topmost piece in the software hierarchy fits into the big picture Jack can be learned (and un-learned) in one hour. Elements of Computing Systems, Nisan & Schocken, MIT Press, Chapter 9: High-Level Language slide 5

6 Hello world /** /** Hello Hello World World program. program. */ */ class class Main Main { void void main main () (){ // // Prints Prints some some text text using using the the standard standard library library do do Output.printString("Hello World"); World"); do do Output.println(); // // New New line line return; return; Some observations: Java-like syntax Typical comments format Standard library Language-specific peculiarities. Elements of Computing Systems, Nisan & Schocken, MIT Press, Chapter 9: High-Level Language slide 6

7 Typical programming tasks in Jack Jack can be used to develop any app that comes to my mind, for example: Procedural programming: a program that computes n Object-oriented programming: a class representing bank accounts Abstract data type representation: a class representing fractions (like 2/5) Data structure representation: a class representing linked lists Etc. We will now discuss the above app examples As we do so, we ll begin to unravel how the magic of a high-level object-based language is delivered by the compiler and by the VM These insights will serve us in the next lectures, when we build the Jack compiler. Elements of Computing Systems, Nisan & Schocken, MIT Press, Chapter 9: High-Level Language slide 7

8 Procedural programming example class class Main Main { /** /** Sums Sums up up n */ */ int int sum sum (int (int n) n) { var var int int sum, sum, i; i; let let sum sum = 0; 0; let let i = 1; 1; while while (~(i (~(i > n)) n)) { let let sum sum = sum sum + i; i; let let i = i + 1; 1; return return sum; sum; void void main main () (){ var var int int n; n; let let n = Keyboard.readInt("Enter n: n: "); "); do do Output.printString("The result result is: is: "); "); do do Output.printInt(sum(n)); return; return; Jack program = a collection of one or more classes Jack class = a collection of one or more subroutines Execution order: when we execute a Jack program, Main.main() starts running. Jack subroutine: method constructor (static method) (the example on the left has s only, as it is object-less ) Standard library: a set of OS services (methods and s) organized in 8 supplied classes: Math, String. Array, Output, Keyboard, Screen, Memory, Sys (OS API in the book). Elements of Computing Systems, Nisan & Schocken, MIT Press, Chapter 9: High-Level Language slide 8

9 Object-oriented programming example The BankAccount class API (method sigantures) /** /** Represents Represents a bank bank account. account. A bank bank account account has has an an owner, owner, an an id, id, and and a balance. balance. The The id id values values start start at at 0 and and increment increment by by 1 each each time time a new new account account is is created. created. */ */ class class BankAccount { /** /** Constructs Constructs a new new bank bank account account with with a 0 balance. balance. */ */ constructor BankAccount new(string new(string owner) owner) /** /** Deposits Deposits the the given given amount amount in in this this account. account. */ */ method method void void deposit(int amount) amount) /** /** Withdraws Withdraws the the given given amount amount from from this this account. account. */ */ method method void void withdraw(int amount) amount) /** /** Prints Prints the the data data of of this this account. account. */ */ method method void void printinfo() /** /** Disposes Disposes this this account. account. */ */ method method void void dispose() dispose() Elements of Computing Systems, Nisan & Schocken, MIT Press, Chapter 9: High-Level Language slide 9

10 Object-oriented programming example (continues) /** /** Represents Represents a bank bank account. account. */ */ class class BankAccount { // // class-level variable variable static static int int newacctid; newacctid; // // Private Private variables variables (aka (aka fields fields / / properties) properties) field field int int id; id; field field String String owner; owner; field field int int balance; balance; /** /** Constructs Constructs a new new bank bank account account */ */ constructor BankAccount new new (String (String owner) owner) { let let id id = newacctid; newacctid; let let newacctid newacctid = newacctid newacctid + 1; 1; let let this.owner this.owner = owner; owner; let let balance balance = 0; 0; return return this; this; 2 // // More More BankAccount methods. methods. 3 // // Code Code in in any any other other class: class: var var int int x; x; var var BankAccount b; 1 b; let let b = BankAccount.new("joe"); Explain: return this The constructor returns the RAM base address of the memory block that stores the data of the newly created BankAccount object Explain: b = BankAccount.new("joe") Calls the constructor (which creates a new BankAccount object), then stores a pointer to the object s base memory address in variable b Behind the scene (following compilation): // b = BankAccount.new("joe") push "joe" call BankAccount.new pop b Explanation: the VM code calls the constructor; the constructor creates a new object, pushes its base address onto the stack, and returns; The calling code then pops the base address into a variable that will now point to the new object. Elements of Computing Systems, Nisan & Schocken, MIT Press, Chapter 9: High-Level Language slide 10

11 Object-oriented programming example (continues) class class BankAccount { static static int int naccounts; naccounts; field field int int id; id; field field String String owner; owner; field field int int balance; balance; // // Constructor......(omitted) /** /** Handles Handles deposits deposits */ */ method method void void deposit deposit (int (int amount) amount) { let let balance balance = balance balance + amount; amount; return; return; /** /** Handles Handles withdrawls withdrawls */ */ method method void void withdraw withdraw (int (int amount){ amount){ if if (~(amount (~(amount > balance)) balance)) { let let balance balance = balance balance - amount; amount; return; return; // // More More BankAccount methods. methods var var BankAccount b1, b1, b2; b2; let let b1 b1 = BankAccount.new("joe"); let let b2 b2 = BankAccount.new("jane"); do do b1.deposit(5000); do do b1.withdraw(1000); Explain: do b1.deposit(5000) In Jack, void methods are invoked using the keyword do (a compilation artifact) The object-oriented method invocation style b1.deposit(5000) is a fabcy way to expres the procedural semantics deposit(b1,5000) Behind the scene (following compilation): // do b1.deposit(5000) push b1 push 5000 call BanAccount.deposit Elements of Computing Systems, Nisan & Schocken, MIT Press, Chapter 9: High-Level Language slide 11

12 Object-oriented programming example (continues) class class BankAccount { static static int int naccounts; naccounts; field field int int id; id; field field String String owner; owner; field field int int balance; balance; // // Constructor......(omitted) /** /** Prints Prints information about about this this account. account. */ */ method method void void printinfo printinfo () (){ do do Output.printInt(id); do do Output.printString(owner); do do Output.printInt(balance); return; return; /** /** Disposes Disposes this this account. account. */ */ method method void void dispose dispose () (){ do do Memory.deAlloc(this); return; return; // // Code Code in in any any other other class: class: var var int int x; x; var var BankAccount b; b; let let b = BankAccount.new("joe"); // // Manipulates b... b... do do b.printinfo(); do do b.dispose(); Explain do b.dispose() Jack has no garbage collection; The programmer is responsible for explicitly recycling memory resources of objects that are no longer needed. // // More More BankAccount methods. methods. Elements of Computing Systems, Nisan & Schocken, MIT Press, Chapter 9: High-Level Language slide 12

13 Abstract data type example The Fraction class API (method sigantures) /** /** Represents Represents a fraction fraction data data type. type. A fraction fraction consists consists of of a numerator numerator and and a denominator, both both int int values values */ */ class class Fraction Fraction { /** /** Constructs Constructs a fraction fraction from from the the given given data data */ */ constructor Fraction Fraction new(int new(intnumerator, numerator, int int denominator) /** /** Reduces Reduces this this fraction, fraction, e.g. e.g. changes changes 20/100 20/100 to to 1/5. 1/5. */ */ method method void void reduce() reduce() /** /** Accessors Accessors method method int int getnumerator() method method int int getdenominator() /** /** Returns Returns the the sum sum of of this this fraction fraction and and the the other other one one */ */ method method Fraction Fraction plus(fraction other) other) /** /** Returns Returns the the product product of of this this fraction fraction and and the the other other one one */ */ method method Fraction Fraction product(fraction other) other) /** /** Prints Prints this this fraction fraction */ */ method method void void print() print() /** /** Disposes Disposes this this fraction fraction */ */ method method void void dispose() dispose() Elements of Computing Systems, Nisan & Schocken, MIT Press, Chapter 9: High-Level Language slide 13

14 Abstract data type example (continues) /** /** Represents Represents a fraction fraction data data type. type. A fraction fraction consists consists of of a numerator numerator and and a denominator, both both int int values values */ */ class class Fraction Fraction { field field int int numerator, numerator, denominator; constructor Fraction Fraction new new (int (int numerator, numerator, int int denominator) { let let this.numerator = numerator; numerator; let let this.denominator = denominator; do do reduce() reduce() // // Reduces Reduces the the new new fraction fraction return return this this /** /** Reduces Reduces this this fraction fraction */ */ method method void void reduce reduce () (){ // // Code Code omitted omitted // // A static static method method that that computes computes the the greatest greatest common common denominator of of a and and b. b. int int gcd gcd (int (int a, a, int int b) b) { // // Code Codeomitted omitted // // Code Code in in any any other other class: class: method method int int getnumerator () (){ var var Fraction Fraction a, a, b; b; return return numerator; numerator; let let a = Fraction.new(2,5); let let b = Fraction.new(70,210); method method int int getdenominator () (){ do do b.print() b.print() // // prints prints "1/3" "1/3" return return denominator; // //(print method method in in next next slide) slide) // // More More Fraction Fraction methods methods follow. follow. Elements of Computing Systems, Nisan & Schocken, MIT Press, Chapter 9: High-Level Language slide 14

15 Abstract data type example (continues) /** /** Represents Represents a fraction fraction data data type. type. A fraction fraction consists consists of of a numerator numerator and and a denominator, both both int int values values */ */ class class Fraction Fraction { field field int int numerator, numerator, denominator; // // Constructor and and previously previously defined defined methods methods omitted omitted /** /** Returns Returns the the sum sum of of this this fraction fraction the the other other one one */ */ method method Fraction Fraction plus plus (Fraction (Fraction other) other) { var var int int sum; sum; let let sum sum = (numerator (numerator* other.getdenominator()) + (other.getnumerator() * denominator()); return return Fraction.new(sum, denominator * other.getdenominator()); // // Similar Similar fraction fraction arithmetic arithmetic methods methods follow, follow, code code omitted. omitted. /** /** Prints Prints this this fraction fraction */ */ method method void void print print () (){ do do Output.printInt(numerator); do do Output.printString("/"); do do Output.printInt(denominator); return return // // Code Code in in any any other other class: class: var var Fraction Fraction a, a, b, b, c; c; let let a = Fraction.new(2,3); let let b = Fraction.new(1,5); // // computes computes c = a + b let let c = a.plus(b); a.plus(b); do do c.print(); c.print(); // // prints prints "13/15" "13/15" Elements of Computing Systems, Nisan & Schocken, MIT Press, Chapter 9: High-Level Language slide 15

16 Data structure example /** /** Represents Represents a sequence sequence of of int int values, values, implemented as as a linked linkedlist. list. The The list list consists consists of of an an atom, atom, which which is is an an int int value, value, and and a tail, tail, which which is is either either a list list or or a null null value. value. */ */ class class List List { field field int int data; data; field field List List next; next; /* /* Creates Creates a new new list list */ */ constructor List List new new (int (int car, car, List List cdr) cdr) { let let data data = car; car; let let next next = cdr; cdr; return return this; this; v 2 v /* /* Disposes Disposes this this list list by by recursively disposing disposing its its tail. tail. */ */ method method void void dispose() dispose() { if if (~(next (~(next = null)) null)) { // do do next.dispose(); // Code Code in in any any other other class: class: do do Memory.deAlloc(this); // // Creates Creates a list list holding holding the the numbers numbers 2,3, 2,3, and and 5: 5: return; return; var var List List v; v; let let v = List.new(5 List.new(5, null); null); let let v = List.new(2 List.new(2, List.new(3,v)); // // class class List. List Elements of Computing Systems, Nisan & Schocken, MIT Press, Chapter 9: High-Level Language slide 16

17 Jack language specification Syntax Data types Variable kinds Expressions Statements Subroutine calling Program structure Standard library (for complete language specification, see the book). Elements of Computing Systems, Nisan & Schocken, MIT Press, Chapter 9: High-Level Language slide 17

18 Jack syntax Elements of Computing Systems, Nisan & Schocken, MIT Press, Chapter 9: High-Level Language slide 18

19 Jack syntax (continues) Elements of Computing Systems, Nisan & Schocken, MIT Press, Chapter 9: High-Level Language slide 19

20 Jack data types Primitive types (Part of the language; Realized by the compiler): int 16-bit 2 s complement (from to 32767) boolean 0 and 1, standing for true and false char unicode character ( a, x, +, %,...) Abstract data types (Standard language extensions; Realized by the OS / standard library): String Array... (extensible) Application-specific types (User-defined; Realized by user applications): BankAccount Fraction List Bat / Ball... (as needed) Elements of Computing Systems, Nisan & Schocken, MIT Press, Chapter 9: High-Level Language slide 20

21 Jack variable kinds and scope Elements of Computing Systems, Nisan & Schocken, MIT Press, Chapter 9: High-Level Language slide 21

22 Jack expressions A Jack expression is any one of the following: A constant A variable name in scope (the variable may be static, field, local, or a parameter) The keyword this, denoting the current object An array element using the syntax arrayname[expression], where arraynname is a variable name of type Array in scope A subroutine call that returns a non-void type An expression prefixed by one of the unary operators or ~ : -expression ~expression (arithmetic negation) (logical negation) An expression of the form expression op expression where op is one of the following: + - * / (integer arithmetic operators) & < > = (boolean and and or operators, bit-wise) (comparison operators) ( expression ) (an expression within parentheses) Elements of Computing Systems, Nisan & Schocken, MIT Press, Chapter 9: High-Level Language slide 22

23 Jack Statements let let varname = expression; expression; or or let let varname[expression] = expression; expression; if if (expression) { statements else else { statements while while (expression) { statements do do -or-method-call; return return expression; expression; or or return; return; Elements of Computing Systems, Nisan & Schocken, MIT Press, Chapter 9: High-Level Language slide 23

24 Jack subroutine calls General syntax: subroutinename(arg0, arg1, ) where each argument is a valid Jack expression Parameter passing is by-value (primitive types) or by-reference (object types) Example 1: Consider the (static method): int sqrt(int n) This can be invoked as follows: sqrt(17) sqrt(x) sqrt((b * b) (4 * a * c)) sqrt(a * sqrt(c - 17) + 3) Etc. In all these examples the argument value is computed and passed by-value Example 2: Consider the method: method Matrix plus (Matrix other); If u and v were variables of type Matrix, this method can be invoked using: u.plus(v) The v variable is passed by-reference, since it refers to an object. Elements of Computing Systems, Nisan & Schocken, MIT Press, Chapter 9: High-Level Language slide 24

25 Noteworthy features of the Jack language The (cumbersome) let keyword, as in let x = 0; The (cumbersome) do keyword, as in do reduce(); No operator priority: * 3 yields 9, since expressions are evaluated left-to-right; To effect the commonly expected result, use 1 + (2 * 3) Only three primitive data types: int, boolean, char; In fact, each one of them is treated as a 16-bit value No casting; a value of any type can be assigned to a variable of any type Array declaration: Array x; followed by x = Array.new(); Static methods are called Constructor methods are called constructor; Invoking a constructor is done using the syntax ClassName.new(argsList) Q: Why did we introduce these features into the Jack language? A: To make the writing of the Jack compiler easy! Any one of these language features can be modified, with a reasonable amount of work, to make them conform to a more typical Java-like syntax. Elements of Computing Systems, Nisan & Schocken, MIT Press, Chapter 9: High-Level Language slide 25

26 Jack program structure class class ClassName { field fieldvariable declarations; static staticvariable declarations; constructor type type { parameterlist ) { local local variable declarations; statements method method type type { parameterlist ) { local local variable declarations; statements type type { parameterlist ) { local local variable declarations; statements About this spec: Every part in this spec can apper 0 or more times The order of the field / static declarations is arbitrary The order of the subroutine declarations is arbitrary Each type is either int, boolean, char, or a class name. A Jack program: Each class is written in a separate file (compilation unit) Jack program = collection of one or more classes, one of which must be named Main The Main class must contain at least one method, named main() Elements of Computing Systems, Nisan & Schocken, MIT Press, Chapter 9: High-Level Language slide 26

27 Jack standard library aka language extensions aka Jack OS class class Math Math { void void init() init() Class Class String String int int abs(int { abs(int x) x) constructor int int multiply(int String String new(int new(int x, x, int maxlength) int y) y) method Class method Class Array int void Array { int void divide(int dispose() dispose() x, x, int int y) y) method method int int int int min(int length() min(int Array Array length() x, x, new(int new(int y) y) size) method class size) method class int char Output int char max(int Output charat(int { max(int x, x, int y) j) y) j) method method method method int void int void void sqrt(int void setcharat(int dispose() void sqrt(int dispose() void movecursor(int x) j, x) j, char char c) i, c) i, int int j) j) method method String Class String Class Screen appendchar(char Screen void void printchar(char { c) c) c) c) method method void void eraselastchar() void void void void printstring(string clearscreen() s) s) method method int class int class Memory intvalue() void Memory void void void printint(int setcolor(boolean { i) b) i) b) method method void void setint(int void void void void println() drawpixel(int println() j) x, x, int int y) peek(int peek(int address) y) j) Class address) char char backspace() void Class void Keyboard void void backspace() Keyboard drawline(int { x1, x1, int int y1, y1, void void poke(int poke(int x2, address, x2, address, int int y2) y2) int int value) value) char char doublequote() char void void drawrectangle(int char keypressed() Class x1, x1, int int y1, y1, char char newline() Class Sys int newline() Array Sys { Array alloc(int alloc(int size) int size) x2, x2, int int y2) char char readchar() y2) void void drawcircle(int x, x, int int y, y, int int r) void r) void void dealloc(array void halt(): halt(): o) o) String String readline(string message) message) void void error(int error(int errorcode) int int readint(string message) message) void void wait(int wait(int duration) duration) Elements of Computing Systems, Nisan & Schocken, MIT Press, Chapter 9: High-Level Language slide 27

28 Perspective Jack is an object-based language: no inheritance Primitive type system Standard library Our hidden agenda: gearing up to learn how to develop the... Compiler (projects 10 and 11) OS (project 12). Elements of Computing Systems, Nisan & Schocken, MIT Press, Chapter 9: High-Level Language slide 28

Handout 1. Introduction to Java programming language. Java primitive types and operations. Reading keyboard Input using class Scanner.

Handout 1. Introduction to Java programming language. Java primitive types and operations. Reading keyboard Input using class Scanner. Handout 1 CS603 Object-Oriented Programming Fall 15 Page 1 of 11 Handout 1 Introduction to Java programming language. Java primitive types and operations. Reading keyboard Input using class Scanner. Java

More information

Compiler I: Syntax Analysis Human Thought

Compiler I: Syntax Analysis Human Thought Course map Compiler I: Syntax Analysis Human Thought Abstract design Chapters 9, 12 H.L. Language & Operating Sys. Compiler Chapters 10-11 Virtual Machine Software hierarchy Translator Chapters 7-8 Assembly

More information

Moving from CS 61A Scheme to CS 61B Java

Moving from CS 61A Scheme to CS 61B Java Moving from CS 61A Scheme to CS 61B Java Introduction Java is an object-oriented language. This document describes some of the differences between object-oriented programming in Scheme (which we hope you

More information

The C Programming Language course syllabus associate level

The C Programming Language course syllabus associate level TECHNOLOGIES The C Programming Language course syllabus associate level Course description The course fully covers the basics of programming in the C programming language and demonstrates fundamental programming

More information

Chapter 7D The Java Virtual Machine

Chapter 7D The Java Virtual Machine This sub chapter discusses another architecture, that of the JVM (Java Virtual Machine). In general, a VM (Virtual Machine) is a hypothetical machine (implemented in either hardware or software) that directly

More information

Fundamentals of Programming and Software Development Lesson Objectives

Fundamentals of Programming and Software Development Lesson Objectives Lesson Unit 1: INTRODUCTION TO COMPUTERS Computer History Create a timeline illustrating the most significant contributions to computing technology Describe the history and evolution of the computer Identify

More information

CSCI 3136 Principles of Programming Languages

CSCI 3136 Principles of Programming Languages CSCI 3136 Principles of Programming Languages Faculty of Computer Science Dalhousie University Winter 2013 CSCI 3136 Principles of Programming Languages Faculty of Computer Science Dalhousie University

More information

Glossary of Object Oriented Terms

Glossary of Object Oriented Terms Appendix E Glossary of Object Oriented Terms abstract class: A class primarily intended to define an instance, but can not be instantiated without additional methods. abstract data type: An abstraction

More information

The programming language C. sws1 1

The programming language C. sws1 1 The programming language C sws1 1 The programming language C invented by Dennis Ritchie in early 1970s who used it to write the first Hello World program C was used to write UNIX Standardised as K&C (Kernighan

More information

McGraw-Hill The McGraw-Hill Companies, Inc., 20 1. 01 0

McGraw-Hill The McGraw-Hill Companies, Inc., 20 1. 01 0 1.1 McGraw-Hill The McGraw-Hill Companies, Inc., 2000 Objectives: To describe the evolution of programming languages from machine language to high-level languages. To understand how a program in a high-level

More information

Fundamentals of Java Programming

Fundamentals of Java Programming Fundamentals of Java Programming This document is exclusive property of Cisco Systems, Inc. Permission is granted to print and copy this document for non-commercial distribution and exclusive use by instructors

More information

CS 106 Introduction to Computer Science I

CS 106 Introduction to Computer Science I CS 106 Introduction to Computer Science I 01 / 21 / 2014 Instructor: Michael Eckmann Today s Topics Introduction Homework assignment Review the syllabus Review the policies on academic dishonesty and improper

More information

Chapter 2: Problem Solving Using C++

Chapter 2: Problem Solving Using C++ Chapter 2: Problem Solving Using C++ 1 Objectives In this chapter, you will learn about: Modular programs Programming style Data types Arithmetic operations Variables and declaration statements Common

More information

Embedded Systems. Review of ANSI C Topics. A Review of ANSI C and Considerations for Embedded C Programming. Basic features of C

Embedded Systems. Review of ANSI C Topics. A Review of ANSI C and Considerations for Embedded C Programming. Basic features of C Embedded Systems A Review of ANSI C and Considerations for Embedded C Programming Dr. Jeff Jackson Lecture 2-1 Review of ANSI C Topics Basic features of C C fundamentals Basic data types Expressions Selection

More information

Course Title: Software Development

Course Title: Software Development Course Title: Software Development Unit: Customer Service Content Standard(s) and Depth of 1. Analyze customer software needs and system requirements to design an information technology-based project plan.

More information

7. Virtual Machine I: Stack Arithmetic 1

7. Virtual Machine I: Stack Arithmetic 1 Chapter 7: Virtual Machine I 99 7. Virtual Machine I: Stack Arithmetic 1 Programmers are creators of universes for which they alone are responsible. Universes of virtually unlimited complexity can be created

More information

A First Book of C++ Chapter 2 Data Types, Declarations, and Displays

A First Book of C++ Chapter 2 Data Types, Declarations, and Displays A First Book of C++ Chapter 2 Data Types, Declarations, and Displays Objectives In this chapter, you will learn about: Data Types Arithmetic Operators Variables and Declarations Common Programming Errors

More information

Sources: On the Web: Slides will be available on:

Sources: On the Web: Slides will be available on: C programming Introduction The basics of algorithms Structure of a C code, compilation step Constant, variable type, variable scope Expression and operators: assignment, arithmetic operators, comparison,

More information

Chapter 8. Arithmetic in C++

Chapter 8. Arithmetic in C++ Christian Jacob Chapter 8 Arithmetic in C++ 8.1 The C++ Vocabulary 8.2 Variables and Types 8.2.1 Data Objects 8.2.2 Variables 8.2.3 Declaration of Variables 8.3 Elementary C++ Data Types 8.3.1 Integers

More information

Lecture 03 Bits, Bytes and Data Types

Lecture 03 Bits, Bytes and Data Types Lecture 03 Bits, Bytes and Data Types In this lecture Computer Languages Assembly Language The compiler Operating system Data and program instructions Bits, Bytes and Data Types ASCII table Data Types

More information

Habanero Extreme Scale Software Research Project

Habanero Extreme Scale Software Research Project Habanero Extreme Scale Software Research Project Comp215: Java Method Dispatch Zoran Budimlić (Rice University) Always remember that you are absolutely unique. Just like everyone else. - Margaret Mead

More information

CS 16: Assembly Language Programming for the IBM PC and Compatibles

CS 16: Assembly Language Programming for the IBM PC and Compatibles CS 16: Assembly Language Programming for the IBM PC and Compatibles First, a little about you Your name Have you ever worked with/used/played with assembly language? If so, talk about it Why are you taking

More information

Computer Programming I

Computer Programming I Computer Programming I COP 2210 Syllabus Spring Semester 2012 Instructor: Greg Shaw Office: ECS 313 (Engineering and Computer Science Bldg) Office Hours: Tuesday: 2:50 4:50, 7:45 8:30 Thursday: 2:50 4:50,

More information

Crash Course in Java

Crash Course in Java Crash Course in Java Based on notes from D. Hollinger Based in part on notes from J.J. Johns also: Java in a Nutshell Java Network Programming and Distributed Computing Netprog 2002 Java Intro 1 What is

More information

KITES TECHNOLOGY COURSE MODULE (C, C++, DS)

KITES TECHNOLOGY COURSE MODULE (C, C++, DS) KITES TECHNOLOGY 360 Degree Solution www.kitestechnology.com/academy.php info@kitestechnology.com technologykites@gmail.com Contact: - 8961334776 9433759247 9830639522.NET JAVA WEB DESIGN PHP SQL, PL/SQL

More information

Thomas Jefferson High School for Science and Technology Program of Studies Foundations of Computer Science. Unit of Study / Textbook Correlation

Thomas Jefferson High School for Science and Technology Program of Studies Foundations of Computer Science. Unit of Study / Textbook Correlation Thomas Jefferson High School for Science and Technology Program of Studies Foundations of Computer Science updated 03/08/2012 Unit 1: JKarel 8 weeks http://www.fcps.edu/is/pos/documents/hs/compsci.htm

More information

Chapter 2: Elements of Java

Chapter 2: Elements of Java Chapter 2: Elements of Java Basic components of a Java program Primitive data types Arithmetic expressions Type casting. The String type (introduction) Basic I/O statements Importing packages. 1 Introduction

More information

The Java Series. Java Essentials I What is Java? Basic Language Constructs. Java Essentials I. What is Java?. Basic Language Constructs Slide 1

The Java Series. Java Essentials I What is Java? Basic Language Constructs. Java Essentials I. What is Java?. Basic Language Constructs Slide 1 The Java Series Java Essentials I What is Java? Basic Language Constructs Slide 1 What is Java? A general purpose Object Oriented programming language. Created by Sun Microsystems. It s a general purpose

More information

D06 PROGRAMMING with JAVA. Ch3 Implementing Classes

D06 PROGRAMMING with JAVA. Ch3 Implementing Classes Cicles Formatius de Grau Superior Desenvolupament d Aplicacions Informàtiques D06 PROGRAMMING with JAVA Ch3 Implementing Classes PowerPoint presentation, created by Angel A. Juan - ajuanp(@)gmail.com,

More information

Topics. Introduction. Java History CS 146. Introduction to Programming and Algorithms Module 1. Module Objectives

Topics. Introduction. Java History CS 146. Introduction to Programming and Algorithms Module 1. Module Objectives Introduction to Programming and Algorithms Module 1 CS 146 Sam Houston State University Dr. Tim McGuire Module Objectives To understand: the necessity of programming, differences between hardware and software,

More information

High-Level Programming Languages. Nell Dale & John Lewis (adaptation by Michael Goldwasser)

High-Level Programming Languages. Nell Dale & John Lewis (adaptation by Michael Goldwasser) High-Level Programming Languages Nell Dale & John Lewis (adaptation by Michael Goldwasser) Low-Level Languages What are disadvantages of low-level languages? (e.g., machine code or assembly code) Programming

More information

Review questions for Chapter 9

Review questions for Chapter 9 Answer first, then check at the end. Review questions for Chapter 9 True/False 1. A compiler translates a high-level language program into the corresponding program in machine code. 2. An interpreter is

More information

Introduction to Java Applications. 2005 Pearson Education, Inc. All rights reserved.

Introduction to Java Applications. 2005 Pearson Education, Inc. All rights reserved. 1 2 Introduction to Java Applications 2.2 First Program in Java: Printing a Line of Text 2 Application Executes when you use the java command to launch the Java Virtual Machine (JVM) Sample program Displays

More information

Chapter 6: Programming Languages

Chapter 6: Programming Languages Chapter 6: Programming Languages Computer Science: An Overview Eleventh Edition by J. Glenn Brookshear Copyright 2012 Pearson Education, Inc. Chapter 6: Programming Languages 6.1 Historical Perspective

More information

Variables are nothing but reserved memory locations to store values. This means that when you create a variable you reserve some space in memory.

Variables are nothing but reserved memory locations to store values. This means that when you create a variable you reserve some space in memory. JAVA TYPES BASIC DATA TYPES GENERAL Variables are nothing but reserved memory locations to store values. This means that when you create a variable you reserve some space in memory. Based on the data type

More information

Lecture 1: Introduction

Lecture 1: Introduction Programming Languages Lecture 1: Introduction Benjamin J. Keller Department of Computer Science, Virginia Tech Programming Languages Lecture 1 Introduction 2 Lecture Outline Preview History of Programming

More information

CS 141: Introduction to (Java) Programming: Exam 1 Jenny Orr Willamette University Fall 2013

CS 141: Introduction to (Java) Programming: Exam 1 Jenny Orr Willamette University Fall 2013 Oct 4, 2013, p 1 Name: CS 141: Introduction to (Java) Programming: Exam 1 Jenny Orr Willamette University Fall 2013 1. (max 18) 4. (max 16) 2. (max 12) 5. (max 12) 3. (max 24) 6. (max 18) Total: (max 100)

More information

Pemrograman Dasar. Basic Elements Of Java

Pemrograman Dasar. Basic Elements Of Java Pemrograman Dasar Basic Elements Of Java Compiling and Running a Java Application 2 Portable Java Application 3 Java Platform Platform: hardware or software environment in which a program runs. Oracle

More information

The Cool Reference Manual

The Cool Reference Manual The Cool Reference Manual Contents 1 Introduction 3 2 Getting Started 3 3 Classes 4 3.1 Features.............................................. 4 3.2 Inheritance............................................

More information

Informatica e Sistemi in Tempo Reale

Informatica e Sistemi in Tempo Reale Informatica e Sistemi in Tempo Reale Introduction to C programming Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa October 25, 2010 G. Lipari (Scuola Superiore Sant Anna)

More information

El Dorado Union High School District Educational Services

El Dorado Union High School District Educational Services El Dorado Union High School District Course of Study Information Page Course Title: ACE Computer Programming II (#495) Rationale: A continuum of courses, including advanced classes in technology is needed.

More information

Storage Classes CS 110B - Rule Storage Classes Page 18-1 \handouts\storclas

Storage Classes CS 110B - Rule Storage Classes Page 18-1 \handouts\storclas CS 110B - Rule Storage Classes Page 18-1 Attributes are distinctive features of a variable. Data type, int or double for example, is an attribute. Storage class is another attribute. There are four storage

More information

Name: Class: Date: 9. The compiler ignores all comments they are there strictly for the convenience of anyone reading the program.

Name: Class: Date: 9. The compiler ignores all comments they are there strictly for the convenience of anyone reading the program. Name: Class: Date: Exam #1 - Prep True/False Indicate whether the statement is true or false. 1. Programming is the process of writing a computer program in a language that the computer can respond to

More information

Example of a Java program

Example of a Java program Example of a Java program class SomeNumbers static int square (int x) return x*x; public static void main (String[] args) int n=20; if (args.length > 0) // change default n = Integer.parseInt(args[0]);

More information

1.1 WHAT IS A PROGRAMMING LANGUAGE?

1.1 WHAT IS A PROGRAMMING LANGUAGE? 1 INTRODUCTION 1.1 What is a Programming Language? 1.2 Abstractions in Programming Languages 1.3 Computational Paradigms 1.4 Language Definition 1.5 Language Translation 1.6 Language Design How we communicate

More information

Java Programming Fundamentals

Java Programming Fundamentals Lecture 1 Part I Java Programming Fundamentals Topics in Quantitative Finance: Numerical Solutions of Partial Differential Equations Instructor: Iraj Kani Introduction to Java We start by making a few

More information

CS 111 Classes I 1. Software Organization View to this point:

CS 111 Classes I 1. Software Organization View to this point: CS 111 Classes I 1 Software Organization View to this point: Data Objects and primitive types Primitive types operators (+, /,,*, %). int, float, double, char, boolean Memory location holds the data Objects

More information

PROBLEM SOLVING SEVENTH EDITION WALTER SAVITCH UNIVERSITY OF CALIFORNIA, SAN DIEGO CONTRIBUTOR KENRICK MOCK UNIVERSITY OF ALASKA, ANCHORAGE PEARSON

PROBLEM SOLVING SEVENTH EDITION WALTER SAVITCH UNIVERSITY OF CALIFORNIA, SAN DIEGO CONTRIBUTOR KENRICK MOCK UNIVERSITY OF ALASKA, ANCHORAGE PEARSON PROBLEM SOLVING WITH SEVENTH EDITION WALTER SAVITCH UNIVERSITY OF CALIFORNIA, SAN DIEGO CONTRIBUTOR KENRICK MOCK UNIVERSITY OF ALASKA, ANCHORAGE PEARSON Addison Wesley Boston San Francisco New York London

More information

Java CPD (I) Frans Coenen Department of Computer Science

Java CPD (I) Frans Coenen Department of Computer Science Java CPD (I) Frans Coenen Department of Computer Science Content Session 1, 12:45-14:30 (First Java Programme, Inheritance, Arithmetic) Session 2, 14:45-16:45 (Input and Programme Constructs) Materials

More information

Debugging. Common Semantic Errors ESE112. Java Library. It is highly unlikely that you will write code that will work on the first go

Debugging. Common Semantic Errors ESE112. Java Library. It is highly unlikely that you will write code that will work on the first go Debugging ESE112 Java Programming: API, Psuedo-Code, Scope It is highly unlikely that you will write code that will work on the first go Bugs or errors Syntax Fixable if you learn to read compiler error

More information

CSE 1223: Introduction to Computer Programming in Java Chapter 2 Java Fundamentals

CSE 1223: Introduction to Computer Programming in Java Chapter 2 Java Fundamentals CSE 1223: Introduction to Computer Programming in Java Chapter 2 Java Fundamentals 1 Recall From Last Time: Java Program import java.util.scanner; public class EggBasket { public static void main(string[]

More information

Java and the JVM. Martin Schöberl

Java and the JVM. Martin Schöberl Java and the JVM Martin Schöberl Overview History and Java features Java technology The Java language A first look into the JVM Disassembling of.class files Java and the JVM 2 History of a Young Java 1992

More information

INTRODUCTION TO OBJECTIVE-C CSCI 4448/5448: OBJECT-ORIENTED ANALYSIS & DESIGN LECTURE 12 09/29/2011

INTRODUCTION TO OBJECTIVE-C CSCI 4448/5448: OBJECT-ORIENTED ANALYSIS & DESIGN LECTURE 12 09/29/2011 INTRODUCTION TO OBJECTIVE-C CSCI 4448/5448: OBJECT-ORIENTED ANALYSIS & DESIGN LECTURE 12 09/29/2011 1 Goals of the Lecture Present an introduction to Objective-C 2.0 Coverage of the language will be INCOMPLETE

More information

Compilers. Introduction to Compilers. Lecture 1. Spring term. Mick O Donnell: michael.odonnell@uam.es Alfonso Ortega: alfonso.ortega@uam.

Compilers. Introduction to Compilers. Lecture 1. Spring term. Mick O Donnell: michael.odonnell@uam.es Alfonso Ortega: alfonso.ortega@uam. Compilers Spring term Mick O Donnell: michael.odonnell@uam.es Alfonso Ortega: alfonso.ortega@uam.es Lecture 1 to Compilers 1 Topic 1: What is a Compiler? 3 What is a Compiler? A compiler is a computer

More information

RARITAN VALLEY COMMUNITY COLLEGE ACADEMIC COURSE OUTLINE. CISY 105 Foundations of Computer Science

RARITAN VALLEY COMMUNITY COLLEGE ACADEMIC COURSE OUTLINE. CISY 105 Foundations of Computer Science I. Basic Course Information RARITAN VALLEY COMMUNITY COLLEGE ACADEMIC COURSE OUTLINE CISY 105 Foundations of Computer Science A. Course Number and Title: CISY-105, Foundations of Computer Science B. New

More information

J a v a Quiz (Unit 3, Test 0 Practice)

J a v a Quiz (Unit 3, Test 0 Practice) Computer Science S-111a: Intensive Introduction to Computer Science Using Java Handout #11 Your Name Teaching Fellow J a v a Quiz (Unit 3, Test 0 Practice) Multiple-choice questions are worth 2 points

More information

Problem Solving With C++ Ninth Edition

Problem Solving With C++ Ninth Edition CISC 1600/1610 Computer Science I Programming in C++ Professor Daniel Leeds dleeds@fordham.edu JMH 328A Introduction to programming with C++ Learn Fundamental programming concepts Key techniques Basic

More information

An Introduction to the Java Programming Language History of Java

An Introduction to the Java Programming Language History of Java An Introduction to the Java Programming Language History of Java In 1991, a group of Sun Microsystems engineers led by James Gosling decided to develop a language for consumer devices (cable boxes, etc.).

More information

JAVA PRIMITIVE DATA TYPE

JAVA PRIMITIVE DATA TYPE JAVA PRIMITIVE DATA TYPE Description Not everything in Java is an object. There is a special group of data types (also known as primitive types) that will be used quite often in programming. For performance

More information

SIT102 Introduction to Programming

SIT102 Introduction to Programming SIT102 Introduction to Programming After working through this session you should: Understand the relationships between operating systems, their user interfaces, and programs; Understand the difference

More information

2. Names, Scopes, and Bindings

2. Names, Scopes, and Bindings 2. Names, Scopes, and Bindings Binding, Lifetime, Static Scope, Encapsulation and Modules, Dynamic Scope Copyright 2010 by John S. Mallozzi Names Variables Bindings Binding time Language design issues

More information

C++ Programming Language

C++ Programming Language C++ Programming Language Lecturer: Yuri Nefedov 7th and 8th semesters Lectures: 34 hours (7th semester); 32 hours (8th semester). Seminars: 34 hours (7th semester); 32 hours (8th semester). Course abstract

More information

Java Interview Questions and Answers

Java Interview Questions and Answers 1. What is the most important feature of Java? Java is a platform independent language. 2. What do you mean by platform independence? Platform independence means that we can write and compile the java

More information

Primitive Data Types Summer 2010 Margaret Reid-Miller

Primitive Data Types Summer 2010 Margaret Reid-Miller Primitive Data Types 15-110 Summer 2010 Margaret Reid-Miller Data Types Data stored in memory is a string of bits (0 or 1). What does 1000010 mean? 66? 'B'? 9.2E-44? How the computer interprets the string

More information

OBJECT ORIENTED PROGRAMMING IN C++

OBJECT ORIENTED PROGRAMMING IN C++ OBJECT ORIENTED PROGRAMMING IN C++ For Off Campus BSc Computer Science Programme UNIT 1 1. The goal of programmers is to develop software that are. A. Correct B. Reliable and maintainable C. Satisfy all

More information

AP Computer Science Java Subset

AP Computer Science Java Subset APPENDIX A AP Computer Science Java Subset The AP Java subset is intended to outline the features of Java that may appear on the AP Computer Science A Exam. The AP Java subset is NOT intended as an overall

More information

Fundamental Computer Science Concepts Sequence TCSU CSCI SEQ A

Fundamental Computer Science Concepts Sequence TCSU CSCI SEQ A Fundamental Computer Science Concepts Sequence TCSU CSCI SEQ A A. Description Introduction to the discipline of computer science; covers the material traditionally found in courses that introduce problem

More information

Course Name: ADVANCE COURSE IN SOFTWARE DEVELOPMENT (Specialization:.Net Technologies)

Course Name: ADVANCE COURSE IN SOFTWARE DEVELOPMENT (Specialization:.Net Technologies) Course Name: ADVANCE COURSE IN SOFTWARE DEVELOPMENT (Specialization:.Net Technologies) Duration of Course: 6 Months Fees: Rs. 25,000/- (including Service Tax) Eligibility: B.E./B.Tech., M.Sc.(IT/ computer

More information

Syllabus for CS 134 Java Programming

Syllabus for CS 134 Java Programming - Java Programming Syllabus Page 1 Syllabus for CS 134 Java Programming Computer Science Course Catalog 2000-2001: This course is an introduction to objectoriented programming using the Java language.

More information

Chapter 15 Functional Programming Languages

Chapter 15 Functional Programming Languages Chapter 15 Functional Programming Languages Introduction - The design of the imperative languages is based directly on the von Neumann architecture Efficiency (at least at first) is the primary concern,

More information

C Compiler Targeting the Java Virtual Machine

C Compiler Targeting the Java Virtual Machine C Compiler Targeting the Java Virtual Machine Jack Pien Senior Honors Thesis (Advisor: Javed A. Aslam) Dartmouth College Computer Science Technical Report PCS-TR98-334 May 30, 1998 Abstract One of the

More information

Programming by Contract. Programming by Contract: Motivation. Programming by Contract: Preconditions and Postconditions

Programming by Contract. Programming by Contract: Motivation. Programming by Contract: Preconditions and Postconditions COMP209 Object Oriented Programming Designing Classes 2 Mark Hall Programming by Contract (adapted from slides by Mark Utting) Preconditions Postconditions Class invariants Programming by Contract An agreement

More information

Java Crash Course Part I

Java Crash Course Part I Java Crash Course Part I School of Business and Economics Institute of Information Systems HU-Berlin WS 2005 Sebastian Kolbe skolbe@wiwi.hu-berlin.de Overview (Short) introduction to the environment Linux

More information

Variables, Constants, and Data Types

Variables, Constants, and Data Types Variables, Constants, and Data Types Primitive Data Types Variables, Initialization, and Assignment Constants Characters Strings Reading for this class: L&L, 2.1-2.3, App C 1 Primitive Data There are eight

More information

6.1. Example: A Tip Calculator 6-1

6.1. Example: A Tip Calculator 6-1 Chapter 6. Transition to Java Not all programming languages are created equal. Each is designed by its creator to achieve a particular purpose, which can range from highly focused languages designed for

More information

Compiler Construction

Compiler Construction Compiler Construction Lecture 1 - An Overview 2003 Robert M. Siegfried All rights reserved A few basic definitions Translate - v, a.to turn into one s own language or another. b. to transform or turn from

More information

Introduction to Java

Introduction to Java Introduction to Java The HelloWorld program Primitive data types Assignment and arithmetic operations User input Conditional statements Looping Arrays CSA0011 Matthew Xuereb 2008 1 Java Overview A high

More information

Writing Portable Programs COS 217

Writing Portable Programs COS 217 Writing Portable Programs COS 217 1 Goals of Today s Class Writing portable programs in C Sources of heterogeneity Data types, evaluation order, byte order, char set, Reading period and final exam Important

More information

SYSTEMS PROGRAMMING C++ INTRODUCTION

SYSTEMS PROGRAMMING C++ INTRODUCTION Faculty of Computer Science / Institute of Systems Architecture / Operating Systems SYSTEMS PROGRAMMING C++ INTRODUCTION Alexander Warg WHY C++? C++ is the language that allows to express ideas from the

More information

An Incomplete C++ Primer. University of Wyoming MA 5310

An Incomplete C++ Primer. University of Wyoming MA 5310 An Incomplete C++ Primer University of Wyoming MA 5310 Professor Craig C. Douglas http://www.mgnet.org/~douglas/classes/na-sc/notes/c++primer.pdf C++ is a legacy programming language, as is other languages

More information

Chapter 13: Program Development and Programming Languages

Chapter 13: Program Development and Programming Languages 15 th Edition Understanding Computers Today and Tomorrow Comprehensive Chapter 13: Program Development and Programming Languages Deborah Morley Charles S. Parker Copyright 2015 Cengage Learning Learning

More information

Semester Review. CSC 301, Fall 2015

Semester Review. CSC 301, Fall 2015 Semester Review CSC 301, Fall 2015 Programming Language Classes There are many different programming language classes, but four classes or paradigms stand out:! Imperative Languages! assignment and iteration!

More information

OKLAHOMA SUBJECT AREA TESTS (OSAT )

OKLAHOMA SUBJECT AREA TESTS (OSAT ) CERTIFICATION EXAMINATIONS FOR OKLAHOMA EDUCATORS (CEOE ) OKLAHOMA SUBJECT AREA TESTS (OSAT ) FIELD 081: COMPUTER SCIENCE September 2008 Subarea Range of Competencies I. Computer Use in Educational Environments

More information

ADVANCED SCHOOL OF SYSTEMS AND DATA STUDIES (ASSDAS) PROGRAM: CTech in Computer Science

ADVANCED SCHOOL OF SYSTEMS AND DATA STUDIES (ASSDAS) PROGRAM: CTech in Computer Science ADVANCED SCHOOL OF SYSTEMS AND DATA STUDIES (ASSDAS) PROGRAM: CTech in Computer Science Program Schedule CTech Computer Science Credits CS101 Computer Science I 3 MATH100 Foundations of Mathematics and

More information

Lecture 1 Introduction to Android

Lecture 1 Introduction to Android These slides are by Dr. Jaerock Kwon at. The original URL is http://kettering.jrkwon.com/sites/default/files/2011-2/ce-491/lecture/alecture-01.pdf so please use that instead of pointing to this local copy

More information

CS412/CS413. Introduction to Compilers Tim Teitelbaum. Lecture 18: Intermediate Code 29 Feb 08

CS412/CS413. Introduction to Compilers Tim Teitelbaum. Lecture 18: Intermediate Code 29 Feb 08 CS412/CS413 Introduction to Compilers Tim Teitelbaum Lecture 18: Intermediate Code 29 Feb 08 CS 412/413 Spring 2008 Introduction to Compilers 1 Summary: Semantic Analysis Check errors not detected by lexical

More information

7.1 Our Current Model

7.1 Our Current Model Chapter 7 The Stack In this chapter we examine what is arguably the most important abstract data type in computer science, the stack. We will see that the stack ADT and its implementation are very simple.

More information

PART-A Questions. 2. How does an enumerated statement differ from a typedef statement?

PART-A Questions. 2. How does an enumerated statement differ from a typedef statement? 1. Distinguish & and && operators. PART-A Questions 2. How does an enumerated statement differ from a typedef statement? 3. What are the various members of a class? 4. Who can access the protected members

More information

Course: Introduction to Java Using Eclipse Training

Course: Introduction to Java Using Eclipse Training Course: Introduction to Java Using Eclipse Training Course Length: Duration: 5 days Course Code: WA1278 DESCRIPTION: This course introduces the Java programming language and how to develop Java applications

More information

C Programming Dr. Hasan Demirel

C Programming Dr. Hasan Demirel C How to Program, H. M. Deitel and P. J. Deitel, Prentice Hall, 5 th edition (3 rd edition or above is also OK). Introduction to C Programming Dr. Hasan Demirel Programming Languages There are three types

More information

Mistakes are the portals of discovery. James Joyce (1882 1941)

Mistakes are the portals of discovery. James Joyce (1882 1941) Appendix B: Test Scripting Language Mistakes are the portals of discovery. James Joyce (1882 1941) Testing is a critically important element of systems development, and one that typically gets little attention

More information

Java Basics: Data Types, Variables, and Loops

Java Basics: Data Types, Variables, and Loops Java Basics: Data Types, Variables, and Loops If debugging is the process of removing software bugs, then programming must be the process of putting them in. - Edsger Dijkstra Plan for the Day Variables

More information

Computing Concepts with Java Essentials

Computing Concepts with Java Essentials 2008 AGI-Information Management Consultants May be used for personal purporses only or by libraries associated to dandelon.com network. Computing Concepts with Java Essentials 3rd Edition Cay Horstmann

More information

Free Java textbook available online. Introduction to the Java programming language. Compilation. A simple java program

Free Java textbook available online. Introduction to the Java programming language. Compilation. A simple java program Free Java textbook available online "Thinking in Java" by Bruce Eckel, 4th edition, 2006, ISBN 0131872486, Pearson Education Introduction to the Java programming language CS 4354 Summer II 2015 The third

More information

C Primer. Fall Introduction C vs. Java... 1

C Primer. Fall Introduction C vs. Java... 1 CS 33 Intro Computer Systems Doeppner C Primer Fall 2016 Contents 1 Introduction 1 1.1 C vs. Java.......................................... 1 2 Functions 1 2.1 The main() Function....................................

More information

Free Java textbook available online. Introduction to the Java programming language. Compilation. A simple java program

Free Java textbook available online. Introduction to the Java programming language. Compilation. A simple java program Free Java textbook available online "Thinking in Java" by Bruce Eckel, 4th edition, 2006, ISBN 0131872486, Pearson Education Introduction to the Java programming language CS 4354 Summer II 2014 Jill Seaman

More information

Stack Allocation. Run-Time Data Structures. Static Structures

Stack Allocation. Run-Time Data Structures. Static Structures Run-Time Data Structures Stack Allocation Static Structures For static structures, a fixed address is used throughout execution. This is the oldest and simplest memory organization. In current compilers,

More information

strsep exercises Introduction C strings Arrays of char

strsep exercises Introduction C strings Arrays of char strsep exercises Introduction The standard library function strsep enables a C programmer to parse or decompose a string into substrings, each terminated by a specified character. The goals of this document

More information

Java Memory Management

Java Memory Management Java Memory Management 1 Tracing program execution Trace: To follow the course or trail of. When you need to find and fix a bug or have to understand a tricky piece of code that your coworker wrote, you

More information

First Java Programs. V. Paúl Pauca. CSC 111D Fall, 2015. Department of Computer Science Wake Forest University. Introduction to Computer Science

First Java Programs. V. Paúl Pauca. CSC 111D Fall, 2015. Department of Computer Science Wake Forest University. Introduction to Computer Science First Java Programs V. Paúl Pauca Department of Computer Science Wake Forest University CSC 111D Fall, 2015 Hello World revisited / 8/23/15 The f i r s t o b l i g a t o r y Java program @author Paul Pauca

More information