Basic Programming Language Syntax
|
|
- Erin Turner
- 6 years ago
- Views:
Transcription
1 Java Created in 1990 by Sun Microsystems. Free compiler from Sun, commercial from many vendors. We use free (Sun) Java on UNIX. Compiling and Interpreting...are processes of translating a high-level programming language to a lower-level language. Example: Java source-code to Byte code (or, Byte code to machine language). The implementation process (Java) 1. programmer types source code 2. programmer starts compiler 3. Java compiler translates source code to byte code 4. programmer starts Java runtime environment (JRE) 5. JRE translates byte code to machine code and executes immediately 6. program runs 7. programmers finds errors and starts from the beginning Example: Basic Programming Language Syntax Programming languages have very strict rules (unlike English or other human languages). The text book has a lot of information on this topic. Java source code (*.java-files) must adhere to such rules. We introduce a few syntax rules for Java (compare with textbook listing 1.1 on page 30). comments: are lines in the source code ignored by the compiler. The first two characters of a comment line must be //
2 identifiers: are strings that are use for naming program objects in your code. So far, the only use for an identifier we know is the name of the program (class). In the textbook listing, Lincoln is an identifier. naming conventions: identifiers must adhere to certain rules as well. The basic rules are: the first character of an identifier must be a letter (a...z,a...z) or an underscore (_) or a dollar sign ($), for the remaining characters digits (0...9) are allowed as well. The textbook contains a syntax diagram visualizing this concept (page 35). reserved words: are strings that the compiler uses, and which therefore cannot be used as identifiers (e.g., public, class). A list of Java reserved words is on page 35. white space: It is possible (and recommended) to nicely format source code through generous use of space characters and/or the breaking down of lines. Examples for well and badly formatted code (which is all the same to the compiler though) are in the textbook, Listings 1.1. through 1.3. basic program structure: every Java program (technically, every class file) at this point must begin with the words public class, followed by an identifier (the class name). The next line in all our simple programs for the next few weeks should be public static void main (String[] args). Compare with the textbook. parentheses (), brackets [], and braces {} are used for different purposes in programs. For now, we only need braces {}, to structure our code. After the ``main'' line (above), the compiler expects a pair of braces, which enclose your entire program. Further pairs of braces will be necessary sometimes, details will follow. Each opening brace must have a corresponding closing brace. Forgetting those is one of the most common programming errors. Syntax and Semantics A computer executes a program by following the programmer's instructions PRECISELY. A computer error is (almost) always a programmer's error. Computers do not make errors calculating your bank account balance. Programmers make errors describing the calculation to the computer. Computers do exactly what they are TOLD, not what the programmers WANTS. If programmer makes any mistake, computer usually produces an error. Three classes of errors: Syntax Error. Programmer breaks the basic rules of the programming language. compiler complains during compilation Runtime Error. Programmer overlooks some condition in the execution of a program (later). JRE complains during program execution
3 Logical Error. Computer does not complain, but program does something different from what the programmer WANTED. Elementary Programming in Java Printing to the Standard Output Window The standard output window is the window in which you type your commands (such as javac Xyz.java or java Xyz). The mode of communication in that window is called command line interaction since you type commands on one line. The computer responds with text output in the same way. The concept of a command line is very old, and in fact predates monitors (screens). Command lines were originally used with tele-typewriters (which are like electric typewriters with a computer connection). Therefore, the computer can only print one character at a time, from left to right, and when a line is full (typically a line has 80 characters), the computer will continue printing on the next line. The position where the computer is going to print next (on a typewriter that would be the position of the print head) is called the cursor position. The cursor is the (possibly blinking) line showing where a character will appear on the screen if you type one. For the next few weeks, any input or output, that is your communication with a running Java-program, will occur in the command line fashion. We will first discuss output, that is communication from the computer program to you. The First Programming Construct: println The simplest thing you can make a Java-program do is print a predefined text to the screen. This is accomplished as follows: System.out.println("Hello World."); The text you want to print must be enclosed in double quotes. The remainder of the statement must be typed exactly as above, including the semicolon at the end. A piece of text enclosed in quotes is called a String and consists of printable characters. The println statement can print strings but also numbers and results of arithmetic expressions. For example: System.out.println(3+4*5); which would print 23 because Java will observe elementary rules of arithmetics. The plus-character has two different meanings in Java: addition of numbers, and concatenation of strings. For example:
4 will print 7 and 34, respectively. System.out.println(3+4); System.out.println("3"+"4"); A small but important point is that the decision which meaning the plus-character has is made by the left operand, i.e., the symbol to the left of the +. That is, is a valid statement and will print 34. System.out.println("3"+4); Grouping elements with parentheses will change the order of computation (usually leftto-right) and also the interpretation of results. This is important in expressions that ``add'' more than two things. For example, the result of (3+4) is always the number 7, whereas the result of 3+4 could be something else, as in the following example: System.out.println("Three plus four is "+(3+4)); System.out.println("Three next to four is "+3+4); which would print Three plus four is 7 and Three next to four is 34, respectively. The latter statement is equivalent to System.out.println(("Three next to four is "+3)+4); because of the left-to-right evaluation in Java. One last minor point about strings is the impossibility to include a quote (") in a string, since strings are enclosed in quotes. As a workaround, Java uses the escape character (the backslash), used as follows: System.out.println("My name is John \"Buster\" Smith"); which would print My name is John "Buster" Smith. If you ever need to print a backslash, use two consecutive backslashes, as in "\\". The Second Programming Construct: print A variation of the println-statement is the print statement, which works exactly like println, with the exception that the cursor is not advanced to the next line at the end of the statement. For example: System.out.print("Ja"); System.out.print("va");
5 would print Java. If you use the print-statement, you should always use at least one println statement after the last print-statement (why?). Objects Object-Oriented Thinking Java is a so-called Object-Oriented Programming Language. The other well-known such language is C, but most current programming languages have at least some objectoriented concepts. There is no good definition for object, since it is a very general concept. We will explain objects through their properties. Objects have two major properties: 1. Objects can execute ``orders'' which are conveyed to them through ``messages''. 2. Objects can ``remember'' information about themselves. In the appropriate terminology: 1. Objects can execute methods which are invoked through method calls. 2. Objects can store information about themselves in the form of variables. For example, a cell in an Excel spreadsheet could be implemented (and most likely is implemented) as an object. Such an object could remember its content, color, font, font size, background color, number format etc., and display its content in the correct format when ordered to do so. That way, when changing the properties of a cell in Excel, one actually updates the variables in the cell-object, and when the spreadsheet is being recomputed by the computer (i.e., every time you change a number or a formula in the sheet), the cell does its share of the work by displaying its own content on the screen. One way of looking at objects is as independent agents that manipulate their own data when instructed to do so, and sometimes return the results of such manipulation in some form. The advantages of objects (over older programming techniques) are many and will become clearer throughout the course. Some initial thoughts are: 1. objects can be written once, and then used many times, in the same program or in other programs 2. objects are usually self-contained and can be developed independently from one another 3. objects can store information about themselves, and use such information at the appropriate time
6 4. objects can act as independent entities in a program, and even run in parallel (at the same time) with other objects on a single CPU. Some of these features also exist in non-object-oriented systems, but object-oriented systems have all these advantages at the same time. Note: a common abbreviation for ``object-oriented'' is ``OO'', such we can say ``Java is an OO-language''. Classes and Instances Many objects in a program are similar. In particular, the methods, i.e., the functionalities of many objects are equal. For example, all cells in a spreadsheet should be able to perform the same tasks. Therefore, it makes sense to write a ``program'' for only one cell in the spreadsheet, and simply ``load the program into memory'' as many times as the spreadsheet has cells. The program that one would write to describe the capabilities of an object is called a class. Whenever such a class is loaded into memory to become an active piece of a program, that copy in memory is called an instance. The process of loading a copy of a class into memory is called instantiation. Example: In our (slightly silly) example from the lecture, we had a number of assistant cooks who were taught the exact same skill set in cooking school. So each cook had the same skills, but still the cooks were not identical. For example, they have different social security numbers (object identifiers), and they stand in different places in the kitchen (memory locations). Also, each cook could remember different things (and do different things) from each other cook at any one time. So the ``assistant cook class'' is described by the common skill set of all these cooks (methods), plus the kinds of things they could possibly remember (variables). Each individual cook is an instance of the ``assistant cook class''. The process of instantiation would correspond to the hiring of a new assistant cook straight out of cooking school. Since many people are not sure about the exact meaning of the word object, I will try to avoid referring to objects in class and instead exclusively use the terms class and instance in the meanings defined above. Summary Classes are templates for meaningful units of the program you are writing. You can instantiate a class one or many times, which means loading it into memory and start using it. Each time you do that, you get an instance. Classes have methods, which are sets of instructions to perform certain tasks, and variables which are places for the temporary storage of information.
7 Classes interact by sending messages to each other. Most such messages are transmitted in the form of method calls, which is a concept similar to that of subroutine calls of other programming languages, but is more flexible and powerful.
Assoc. Prof. Dr. Marenglen Biba. (C) 2010 Pearson Education, Inc. All rights reserved.
Assoc. Prof. Dr. Marenglen Biba (C) 2010 Pearson Education, Inc. All rights reserved. Java application A computer program that executes when you use the java command to launch the Java Virtual Machine
More information12/22/11. Java How to Program, 9/e. Help you get started with Eclipse and NetBeans integrated development environments.
Java How to Program, 9/e Education, Inc. All Rights Reserved. } Java application programming } Use tools from the JDK to compile and run programs. } Videos at www.deitel.com/books/jhtp9/ Help you get started
More informationChapter 1. Introduction
Chapter 1 Introduction Chapter Scope Introduce the Java programming language Program compilation and execution Problem solving in general The software development process Overview of object-oriented principles
More informationProgramming with Java
Programming with Java Variables and Output Statement Lecture 03 First stage Software Engineering Dep. Saman M. Omer 2017-2018 Objectives ü Declare and assign values to variable ü How to use eclipse ü What
More informationIdentifiers. Identifiers are the words a programmer uses in a program Some identifiers are already defined. Some are made up by the programmer:
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
More information2 rd class Department of Programming. OOP with Java Programming
1. Structured Programming and Object-Oriented Programming During the 1970s and into the 80s, the primary software engineering methodology was structured programming. The structured programming approach
More informationFirst Java Program - Output to the Screen
First Java Program - Output to the Screen These notes are written assuming that the reader has never programmed in Java, but has programmed in another language in the past. In any language, one of the
More informationObjectives. Problem Solving. Introduction. An overview of object-oriented concepts. Programming and programming languages An introduction to Java
Introduction Objectives An overview of object-oriented concepts. Programming and programming languages An introduction to Java 1-2 Problem Solving The purpose of writing a program is to solve a problem
More informationChapter. Focus of the Course. Object-Oriented Software Development. program design, implementation, and testing
Introduction 1 Chapter 5 TH EDITION Lewis & Loftus java Software Solutions Foundations of Program Design 2007 Pearson Addison-Wesley. All rights reserved Focus of the Course Object-Oriented Software Development
More informationA PROGRAM IS A SEQUENCE of instructions that a computer can execute to
A PROGRAM IS A SEQUENCE of instructions that a computer can execute to perform some task. A simple enough idea, but for the computer to make any use of the instructions, they must be written in a form
More informationComputer Hardware. Java Software Solutions Lewis & Loftus. Key Hardware Components 12/17/2013
Java Software Solutions Lewis & Loftus Chapter 1 Notes Computer Hardware Key Hardware Components CPU central processing unit Input / Output devices Main memory (RAM) Secondary storage devices: Hard drive
More informationLab # 2. For today s lab:
1 ITI 1120 Lab # 2 Contributors: G. Arbez, M. Eid, D. Inkpen, A. Williams, D. Amyot 1 For today s lab: Go the course webpage Follow the links to the lab notes for Lab 2. Save all the java programs you
More informationCS112 Lecture: Primitive Types, Operators, Strings
CS112 Lecture: Primitive Types, Operators, Strings Last revised 1/24/06 Objectives: 1. To explain the fundamental distinction between primitive types and reference types, and to introduce the Java primitive
More informationObject oriented programming. Instructor: Masoud Asghari Web page: Ch: 3
Object oriented programming Instructor: Masoud Asghari Web page: http://www.masses.ir/lectures/oops2017sut Ch: 3 1 In this slide We follow: https://docs.oracle.com/javase/tutorial/index.html Trail: Learning
More informationCS112 Lecture: Variables, Expressions, Computation, Constants, Numeric Input-Output
CS112 Lecture: Variables, Expressions, Computation, Constants, Numeric Input-Output Last revised January 12, 2006 Objectives: 1. To introduce arithmetic operators and expressions 2. To introduce variables
More informationCS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 3: SEP. 13TH INSTRUCTOR: JIAYIN WANG
CS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 3: SEP. 13TH INSTRUCTOR: JIAYIN WANG 1 Notice Reading Assignment Chapter 1: Introduction to Java Programming Homework 1 It is due this coming Sunday
More informationEntry Point of Execution: the main Method. Elementary Programming. Learning Outcomes. Development Process
Entry Point of Execution: the main Method Elementary Programming EECS1021: Object Oriented Programming: from Sensors to Actuators Winter 2019 CHEN-WEI WANG For now, all your programming exercises will
More informationFull file at
Java Programming: From Problem Analysis to Program Design, 3 rd Edition 2-1 Chapter 2 Basic Elements of Java At a Glance Instructor s Manual Table of Contents Overview Objectives s Quick Quizzes Class
More informationCOMP 202 Java in one week
COMP 202 Java in one week... Continued CONTENTS: Return to material from previous lecture At-home programming exercises Please Do Ask Questions It's perfectly normal not to understand everything Most of
More informationIntroduction to OOP Using Java Pearson Education, Inc. All rights reserved.
1 1 Introduction to OOP Using Java 2 Introduction Sun s implementation called the Java Development Kit (JDK) Object-Oriented Programming Java is language of choice for networked applications Java Enterprise
More informationIntroduction To Java. Chapter 1. Origins of the Java Language. Origins of the Java Language. Objects and Methods. Origins of the Java Language
Chapter 1 Getting Started Introduction To Java Most people are familiar with Java as a language for Internet applications We will study Java as a general purpose programming language The syntax of expressions
More informationC: How to Program. Week /Mar/05
1 C: How to Program Week 2 2007/Mar/05 Chapter 2 - Introduction to C Programming 2 Outline 2.1 Introduction 2.2 A Simple C Program: Printing a Line of Text 2.3 Another Simple C Program: Adding Two Integers
More informationCourse Outline. Introduction to java
Course Outline 1. Introduction to OO programming 2. Language Basics Syntax and Semantics 3. Algorithms, stepwise refinements. 4. Quiz/Assignment ( 5. Repetitions (for loops) 6. Writing simple classes 7.
More informationCOSC 123 Computer Creativity. Introduction to Java. Dr. Ramon Lawrence University of British Columbia Okanagan
COSC 123 Computer Creativity Introduction to Java Dr. Ramon Lawrence University of British Columbia Okanagan ramon.lawrence@ubc.ca Key Points 1) Introduce Java, a general-purpose programming language,
More informationChapter 1. Introduction to Computers and Java Objects. Background information. » important regardless of programming language. Introduction to Java
Chapter 1 Introduction to Computers and Java Objects Background information» important regardless of programming language Introduction to Java Chapter 1 Java: an Introduction to Computer Science & Programming
More informationCS112 Lecture: Working with Numbers
CS112 Lecture: Working with Numbers Last revised January 30, 2008 Objectives: 1. To introduce arithmetic operators and expressions 2. To expand on accessor methods 3. To expand on variables, declarations
More informationCS2900 Introductory Programming with Python and C++ Kevin Squire LtCol Joel Young Fall 2007
CS2900 Introductory Programming with Python and C++ Kevin Squire LtCol Joel Young Fall 2007 Course Web Site http://www.nps.navy.mil/cs/facultypages/squire/cs2900 All course related materials will be posted
More informationIntroduction to Java. Java Programs Classes, Methods, and Statements Comments Strings Escape Sequences Identifiers Keywords
Introduction to Java Java Programs Classes, Methods, and Statements Comments Strings Escape Sequences Identifiers Keywords Program Errors Syntax Runtime Logic Procedural Decomposition Methods Flow of Control
More informationOverview. - General Data Types - Categories of Words. - Define Before Use. - The Three S s. - End of Statement - My First Program
Overview - General Data Types - Categories of Words - The Three S s - Define Before Use - End of Statement - My First Program a description of data, defining a set of valid values and operations List of
More informationFundamentals of Programming. By Budditha Hettige
Fundamentals of Programming By Budditha Hettige Overview Exercises (Previous Lesson) The JAVA Programming Languages Java Virtual Machine Characteristics What is a class? JAVA Standards JAVA Keywords How
More informationChapter 2: Programming Concepts
Chapter 2: Programming Concepts Objectives Students should Know the steps required to create programs using a programming language and related terminology. Be familiar with the basic structure of a Java
More informationLESSON 1. A C program is constructed as a sequence of characters. Among the characters that can be used in a program are:
LESSON 1 FUNDAMENTALS OF C The purpose of this lesson is to explain the fundamental elements of the C programming language. C like other languages has all alphabet and rules for putting together words
More informationExpressions and Data Types CSC 121 Fall 2015 Howard Rosenthal
Expressions and Data Types CSC 121 Fall 2015 Howard Rosenthal Lesson Goals Understand the basic constructs of a Java Program Understand how to use basic identifiers Understand simple Java data types and
More informationTOPIC 2 INTRODUCTION TO JAVA AND DR JAVA
1 TOPIC 2 INTRODUCTION TO JAVA AND DR JAVA Notes adapted from Introduction to Computing and Programming with Java: A Multimedia Approach by M. Guzdial and B. Ericson, and instructor materials prepared
More informationBasics of Java Programming
Basics of Java Programming Lecture 2 COP 3252 Summer 2017 May 16, 2017 Components of a Java Program statements - A statement is some action or sequence of actions, given as a command in code. A statement
More informationPace University. Fundamental Concepts of CS121 1
Pace University Fundamental Concepts of CS121 1 Dr. Lixin Tao http://csis.pace.edu/~lixin Computer Science Department Pace University October 12, 2005 This document complements my tutorial Introduction
More informationCOMP 202 Java in one week
CONTENTS: Basics of Programming Variables and Assignment Data Types: int, float, (string) Example: Implementing a calculator COMP 202 Java in one week The Java Programming Language A programming language
More informationCSI Lab 02. Tuesday, January 21st
CSI Lab 02 Tuesday, January 21st Objectives: Explore some basic functionality of python Introduction Last week we talked about the fact that a computer is, among other things, a tool to perform high speed
More informationTutorials. Tutorial every Friday at 11:30 AM in Toldo 204 * discuss the next lab assignment
60-212 subir@cs.uwindsor.ca Phone # 253-3000 Ext. 2999 web site for course www.cs.uwindsor.ca/60-212 Dr. Subir Bandyopadhayay Website has detailed rules and regulations All assignments and labs will be
More informationJava Programming Fundamentals - Day Instructor: Jason Yoon Website:
Java Programming Fundamentals - Day 1 07.09.2016 Instructor: Jason Yoon Website: http://mryoon.weebly.com Quick Advice Before We Get Started Java is not the same as javascript! Don t get them confused
More informationTester vs. Controller. Elementary Programming. Learning Outcomes. Compile Time vs. Run Time
Tester vs. Controller Elementary Programming EECS1022: Programming for Mobile Computing Winter 2018 CHEN-WEI WANG For effective illustrations, code examples will mostly be written in the form of a tester
More informationFirst Programs. CSE 1310 Introduction to Computers and Programming Vassilis Athitsos University of Texas at Arlington
First Programs CSE 1310 Introduction to Computers and Programming Vassilis Athitsos University of Texas at Arlington 1 Output System.out.println( ) prints out something. System.out.println is the first
More informationSome Computer Preliminaries
Some Computer Preliminaries Before we get started, let's look at some basic components that play a major role in a computer's ability to run programs: 1) Central Processing Unit: The "brains" of the computer
More informationElementary Programming
Elementary Programming EECS1022: Programming for Mobile Computing Winter 2018 CHEN-WEI WANG Learning Outcomes Learn ingredients of elementary programming: data types [numbers, characters, strings] literal
More informationIT 374 C# and Applications/ IT695 C# Data Structures
IT 374 C# and Applications/ IT695 C# Data Structures Module 2.1: Introduction to C# App Programming Xianrong (Shawn) Zheng Spring 2017 1 Outline Introduction Creating a Simple App String Interpolation
More informationFirst Programs. CSE 1310 Introduction to Computers and Programming Vassilis Athitsos University of Texas at Arlington
First Programs CSE 1310 Introduction to Computers and Programming Vassilis Athitsos University of Texas at Arlington 1 Output System.out.println( ) prints out something. System.out.println is the first
More informationExpressions and Data Types CSC 121 Spring 2015 Howard Rosenthal
Expressions and Data Types CSC 121 Spring 2015 Howard Rosenthal Lesson Goals Understand the basic constructs of a Java Program Understand how to use basic identifiers Understand simple Java data types
More informationICOM 4015: Advanced Programming
ICOM 4015: Advanced Programming Lecture 1 Reading: Chapter One: Introduction Chapter 1 Introduction Chapter Goals To understand the activity of programming To learn about the architecture of computers
More informationObjectives: 1. Introduce the course. 2. Define programming 3. Introduce fundamental concepts of OO: object, class
CS112 Lecture: Course Introduction Last revised 1/3/06 Objectives: 1. Introduce the course. 2. Define programming 3. Introduce fundamental concepts of OO: object, class Materials: 1. Questionnaire 2. Syllabi
More informationChapter 2 - Introduction to C Programming
Chapter 2 - Introduction to C Programming 2 Outline 2.1 Introduction 2.2 A Simple C Program: Printing a Line of Text 2.3 Another Simple C Program: Adding Two Integers 2.4 Memory Concepts 2.5 Arithmetic
More informationWentworth Institute of Technology. Engineering & Technology WIT COMP1000. Java Basics
WIT COMP1000 Java Basics Java Origins Java was developed by James Gosling at Sun Microsystems in the early 1990s It was derived largely from the C++ programming language with several enhancements Java
More information17 Hello world 18 Type: String: literal 19 Standard API: System: out.println() 20 Hello world 21 Statement 22 Statement: simple statements are ended w
List of Slides 1 Title 2 Chapter 2: Sequential execution and program errors 3 Chapter aims 4 Section 2: Example:Hello world 5 Aim 6 Class: programs are divided into classes 7 Class: public class 8 Class:
More informationCSE 142. Lecture 1 Course Introduction; Basic Java. Portions Copyright 2008 by Pearson Education
CSE 142 Lecture 1 Course Introduction; Basic Java Welcome Today: Course mechanics A little about computer science & engineering (CSE) And how this course relates Java programs that print text 2 Handouts
More informationLesson 1: Writing Your First JavaScript
JavaScript 101 1-1 Lesson 1: Writing Your First JavaScript OBJECTIVES: In this lesson you will be taught how to Use the tag Insert JavaScript code in a Web page Hide your JavaScript
More informationList of Slides 1 Title 2 Chapter 2: Sequential execution and program errors 3 Chapter aims 4 Section 2: Example:Hello world 5 Aim 6 Class: programs ar
List of Slides 1 Title 2 Chapter 2: Sequential execution and program errors 3 Chapter aims 4 Section 2: Example:Hello world 5 Aim 6 Class: programs are divided into classes 7 Class: public class 8 Class:
More informationFirst Programs. CSE 1310 Introduction to Computers and Programming Vassilis Athitsos University of Texas at Arlington
First Programs CSE 1310 Introduction to Computers and Programming Vassilis Athitsos University of Texas at Arlington 1 Output System.out.println( ) prints out something. System.out.println is the first
More informationTable of Contents Date(s) Title/Topic Page #s. Abstraction
Table of Contents Date(s) Title/Topic Page #s 9/10 2.2 String Literals, 2.3 Variables and Assignment 34-35 Abstraction An abstraction hides (or suppresses) the right details at the right time An object
More informationFundamentals of Programming. Lecture 3: Introduction to C Programming
Fundamentals of Programming Lecture 3: Introduction to C Programming Instructor: Fatemeh Zamani f_zamani@ce.sharif.edu Sharif University of Technology Computer Engineering Department Outline A Simple C
More informationJava Bytecode (binary file)
Java is Compiled Unlike Python, which is an interpreted langauge, Java code is compiled. In Java, a compiler reads in a Java source file (the code that we write), and it translates that code into bytecode.
More informationCONTENTS: What Is Programming? How a Computer Works Programming Languages Java Basics. COMP-202 Unit 1: Introduction
CONTENTS: What Is Programming? How a Computer Works Programming Languages Java Basics COMP-202 Unit 1: Introduction Announcements Did you miss the first lecture? Come talk to me after class. If you want
More informationCMSC 150 LECTURE 1 INTRODUCTION TO COURSE COMPUTER SCIENCE HELLO WORLD
CMSC 150 INTRODUCTION TO COMPUTING ACKNOWLEDGEMENT: THESE SLIDES ARE ADAPTED FROM SLIDES PROVIDED WITH INTRODUCTION TO JAVA PROGRAMMING, LIANG (PEARSON 2014) LECTURE 1 INTRODUCTION TO COURSE COMPUTER SCIENCE
More informationIntroduction to JAVA
Java A001 Hello World Let's study the entire program below: Introduction to JAVA // The "A001" class. import java.awt.*; public class A001 { public static void main (String[] args) { System.out.println("Hello
More informationAn overview of Java, Data types and variables
An overview of Java, Data types and variables Lecture 2 from (UNIT IV) Prepared by Mrs. K.M. Sanghavi 1 2 Hello World // HelloWorld.java: Hello World program import java.lang.*; class HelloWorld { public
More informationSchool of Computer Science CPS109 Course Notes 5 Alexander Ferworn Updated Fall 15
Table of Contents 1 INTRODUCTION... 1 2 IF... 1 2.1 BOOLEAN EXPRESSIONS... 3 2.2 BLOCKS... 3 2.3 IF-ELSE... 4 2.4 NESTING... 5 3 SWITCH (SOMETIMES KNOWN AS CASE )... 6 3.1 A BIT ABOUT BREAK... 7 4 CONDITIONAL
More informationProgramming for Engineers Introduction to C
Programming for Engineers Introduction to C ICEN 200 Spring 2018 Prof. Dola Saha 1 Simple Program 2 Comments // Fig. 2.1: fig02_01.c // A first program in C begin with //, indicating that these two lines
More informationFeatures of C. Portable Procedural / Modular Structured Language Statically typed Middle level language
1 History C is a general-purpose, high-level language that was originally developed by Dennis M. Ritchie to develop the UNIX operating system at Bell Labs. C was originally first implemented on the DEC
More informationCOMP163. Introduction to Computer Programming. Introduction and Overview of the Hardware
COMP163 Introduction to Computer Programming Introduction and Overview of the Hardware Reading Read chapter 1 of the online textbook What is the difference between a simple calculator and a computer? Hardware
More information2.1. Chapter 2: Parts of a C++ Program. Parts of a C++ Program. Introduction to C++ Parts of a C++ Program
Chapter 2: Introduction to C++ 2.1 Parts of a C++ Program Copyright 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 2-1 Parts of a C++ Program Parts of a C++ Program // sample C++ program
More informationIntroduction to Software Development (ISD) David Weston and Igor Razgon
Introduction to Software Development (ISD) David Weston and Igor Razgon Autumn term 2013 Course book The primary book supporting the ISD module is: Java for Everyone, by Cay Horstmann, 2nd Edition, Wiley,
More informationCS125 : Introduction to Computer Science. Lecture Notes #4 Type Checking, Input/Output, and Programming Style
CS125 : Introduction to Computer Science Lecture Notes #4 Type Checking, Input/Output, and Programming Style c 2005, 2004, 2002, 2001, 2000 Jason Zych 1 Lecture 4 : Type Checking, Input/Output, and Programming
More informationWelcome to CSE 142! Whitaker Brand. University of Washington, Winter 2018
Welcome to CSE 142! Whitaker Brand University of Washington, Winter 2018 1 What is computer science? computers? science? programming? late lonely nights in front of the computer? ALGORITHMIC THINKING al
More informationCS 241 Computer Programming. Introduction. Teacher Assistant. Hadeel Al-Ateeq
CS 241 Computer Programming Introduction Teacher Assistant Hadeel Al-Ateeq 1 2 Course URL: http://241cs.wordpress.com/ Hadeel Al-Ateeq 3 Textbook HOW TO PROGRAM BY C++ DEITEL AND DEITEL, Seventh edition.
More informationSoftware and Programming 1
Software and Programming 1 Lab 1: Introduction, HelloWorld Program and use of the Debugger 17 January 2019 SP1-Lab1-2018-19.pptx Tobi Brodie (tobi@dcs.bbk.ac.uk) 1 Module Information Lectures: Afternoon
More informationGet JAVA. I will just tell you what I did (on January 10, 2017). I went to:
Get JAVA To compile programs you need the JDK (Java Development Kit). To RUN programs you need the JRE (Java Runtime Environment). This download will get BOTH of them, so that you will be able to both
More informationPerl Basics. Structure, Style, and Documentation
Perl Basics Structure, Style, and Documentation Copyright 2006 2009 Stewart Weiss Easy to read programs Your job as a programmer is to create programs that are: easy to read easy to understand, easy to
More informationLanguage Basics. /* The NUMBER GAME - User tries to guess a number between 1 and 10 */ /* Generate a random number between 1 and 10 */
Overview Language Basics This chapter describes the basic elements of Rexx. It discusses the simple components that make up the language. These include script structure, elements of the language, operators,
More informationEntry Point of Execution: the main Method. Elementary Programming. Compile Time vs. Run Time. Learning Outcomes
Entry Point of Execution: the main Method Elementary Programming EECS2030: Advanced Object Oriented Programming Fall 2017 CHEN-WEI WANG For now, all your programming exercises will be defined within the
More informationIntroduction to Java. Liang, Introduction to Java Programming, Ninth Edition, (c) 2013 Pearson Education, Inc. All rights reserved.
Introduction to Java 1 Programs Computer programs, known as software, are instructions to the computer. You tell a computer what to do through programs. Programs are written using programming languages.
More informationWelcome to CSE 142! Zorah Fung University of Washington, Spring Building Java Programs Chapter 1 Lecture 1: Introduction; Basic Java Programs
Welcome to CSE 142! Zorah Fung University of Washington, Spring 2015 Building Java Programs Chapter 1 Lecture 1: Introduction; Basic Java Programs reading: 1.1-1.3 1 What is computer science? computers?
More informationChapter 2 Using Data. Instructor s Manual Table of Contents. At a Glance. A Guide to this Instructor s Manual:
Java Programming, Eighth Edition 2-1 Chapter 2 Using Data A Guide to this Instructor s Manual: We have designed this Instructor s Manual to supplement and enhance your teaching experience through classroom
More informationVARIABLES. Aim Understanding how computer programs store values, and how they are accessed and used in computer programs.
Lesson 2 VARIABLES Aim Understanding how computer programs store values, and how they are accessed and used in computer programs. WHAT ARE VARIABLES? When you input data (i.e. information) into a computer
More informationReview Chapters 1 to 4. Instructor: Scott Kristjanson CMPT 125/125 SFU Burnaby, Fall 2013
Review Chapters 1 to 4 Instructor: Scott Kristjanson CMPT 125/125 SFU Burnaby, Fall 2013 Introduction to Java Chapters 1 and 2 The Java Language Section 1.1 Data & Expressions Sections 2.1 2.5 Instructor:
More informationCPS122 Lecture: From Python to Java
Objectives: CPS122 Lecture: From Python to Java last revised January 7, 2013 1. To introduce the notion of a compiled language 2. To introduce the notions of data type and a statically typed language 3.
More informationCSCI 2010 Principles of Computer Science. Data and Expressions 08/09/2013 CSCI
CSCI 2010 Principles of Computer Science Data and Expressions 08/09/2013 CSCI 2010 1 Data Types, Variables and Expressions in Java We look at the primitive data types, strings and expressions that are
More informationSoftware Development 2
Software Development 2 Course Map This module introduces some of the techniques programmers use to create applications and programs. Introduction Computer Principles and Components Software Development
More informationChapter 17. Fundamental Concepts Expressed in JavaScript
Chapter 17 Fundamental Concepts Expressed in JavaScript Learning Objectives Tell the difference between name, value, and variable List three basic data types and the rules for specifying them in a program
More informationCoding Workshop. Learning to Program with an Arduino. Lecture Notes. Programming Introduction Values Assignment Arithmetic.
Coding Workshop Learning to Program with an Arduino Lecture Notes Table of Contents Programming ntroduction Values Assignment Arithmetic Control Tests f Blocks For Blocks Functions Arduino Main Functions
More informationUniversità degli Studi di Bologna Facoltà di Ingegneria. Principles, Models, and Applications for Distributed Systems M
Università degli Studi di Bologna Facoltà di Ingegneria Principles, Models, and Applications for Distributed Systems M tutor Isam M. Al Jawarneh, PhD student isam.aljawarneh3@unibo.it Mobile Middleware
More informationIntroduction to Java Applications; Input/Output and Operators
www.thestudycampus.com Introduction to Java Applications; Input/Output and Operators 2.1 Introduction 2.2 Your First Program in Java: Printing a Line of Text 2.3 Modifying Your First Java Program 2.4 Displaying
More informationCS11 Java. Fall Lecture 1
CS11 Java Fall 2006-2007 Lecture 1 Welcome! 8 Lectures Slides posted on CS11 website http://www.cs.caltech.edu/courses/cs11 7-8 Lab Assignments Made available on Mondays Due one week later Monday, 12 noon
More informationChapter 2: Data and Expressions
Chapter 2: Data and Expressions CS 121 Department of Computer Science College of Engineering Boise State University August 21, 2017 Chapter 2: Data and Expressions CS 121 1 / 51 Chapter 1 Terminology Review
More informationProgramming Language Concepts: Lecture 2
Programming Language Concepts: Lecture 2 Madhavan Mukund Chennai Mathematical Institute madhavan@cmi.ac.in http://www.cmi.ac.in/~madhavan/courses/pl2011 PLC 2011, Lecture 2, 6 January 2011 Classes and
More informationCompSci 125 Lecture 02
Assignments CompSci 125 Lecture 02 Java and Java Programming with Eclipse! Homework:! http://coen.boisestate.edu/jconrad/compsci-125-homework! hw1 due Jan 28 (MW), 29 (TuTh)! Programming:! http://coen.boisestate.edu/jconrad/cs125-programming-assignments!
More informationSt. Edmund Preparatory High School Brooklyn, NY
AP Computer Science Mr. A. Pinnavaia Summer Assignment St. Edmund Preparatory High School Name: I know it has been about 7 months since you last thought about programming. It s ok. I wouldn t want to think
More information7/8/10 KEY CONCEPTS. Problem COMP 10 EXPLORING COMPUTER SCIENCE. Algorithm. Lecture 2 Variables, Types, and Programs. Program PROBLEM SOLVING
KEY CONCEPTS COMP 10 EXPLORING COMPUTER SCIENCE Lecture 2 Variables, Types, and Programs Problem Definition of task to be performed (by a computer) Algorithm A particular sequence of steps that will solve
More informationCMPT 125: Lecture 3 Data and Expressions
CMPT 125: Lecture 3 Data and Expressions Tamara Smyth, tamaras@cs.sfu.ca School of Computing Science, Simon Fraser University January 3, 2009 1 Character Strings A character string is an object in Java,
More informationChapter 2 Author Notes
Chapter 2 Author Notes Good Programming Practice 2.1 Every program should begin with a comment that explains the purpose of the program, the author and the date and time the program was last modified.
More informationWeek - 01 Lecture - 04 Downloading and installing Python
Programming, Data Structures and Algorithms in Python Prof. Madhavan Mukund Department of Computer Science and Engineering Indian Institute of Technology, Madras Week - 01 Lecture - 04 Downloading and
More informationCS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 2: SEP. 8TH INSTRUCTOR: JIAYIN WANG
CS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 2: SEP. 8TH INSTRUCTOR: JIAYIN WANG 1 Notice Class Website http://www.cs.umb.edu/~jane/cs114/ Reading Assignment Chapter 1: Introduction to Java Programming
More informationA variable is a name for a location in memory A variable must be declared
Variables A variable is a name for a location in memory A variable must be declared, specifying the variable's name and the type of information that will be held in it data type variable name int total;
More information