Expressions and Data Types CSC 121 Spring 2017 Howard Rosenthal

Save this PDF as:
Size: px
Start display at page:

Download "Expressions and Data Types CSC 121 Spring 2017 Howard Rosenthal"

Transcription

1 Expressions and Data Types CSC 121 Spring 2017 Howard Rosenthal

2 Lesson Goals Understand the basic constructs of a Java Program Understand how to use basic identifiers Understand simple Java data types and the operations on those types Understand how to write and evaluate expressions Understand the concept of casting 2

3 Key Terms and Defini/ons public class Hello { public static void main ( String[] args ) { System.out.println("Hello World!"); } } Above is a source program (source file) for a Java program. The purpose of this program is to type the characters Hello World! on the monitor. The file must be named Hello.java to match the name of the class. The upper and lower case characters of the file name are important. On all computers, upper and lower case inside the program are important. Java is very case sensitive The first line class Hello says that this source program defines a class called Hello. A class is a section of a program. Small programs often consist of just one class. Most programs use multiple classes to create objects Some classes are are imported while other are created by the programmer Every class is contained within a set of braces 3

4 Key Terms and Defini/ons (2) When the program is compiled, the compiler will make a file of bytecodes called Hello.class. - This is the file that the JVM uses. If the file is named hello.java with a small h it will compile but hello.class won t exist if the code declares the class with a capital H It will create a class Hello.class that will work but keep it simple and follow the capitalization exactly Methods are built out of statements. The statements in a method are placed between braces { and } as in this example. A method is a section of a class that performs a specific task All programs start executing from the main method Each method is contained within a set of braces Braces For every left brace { there is a right brace } that matches. Usually there will be sets of matching braces inside other sets of matching braces. The first brace in a class (a left brace) will match the last brace in that class (a right brace). A brace can match just one other brace. Use indenting to show how the braces match (and thereby show the logic of the program). Look at the example. Increase the indenting by three spaces for statements inside a left and right brace. If another pair of braces is nested within those braces, increase the indenting for the statements they contain by another three spaces. Line up the braces vertically. With Notepad++ the indent levels for both braces and parentheses are color coded After a left brace an indent will be created for you automatically Make sure that you step back to align your left and right braces You can also indent when necessary by using the tab key 4

5 Key Terms and Defini/ons (3) Most classes contain many more lines than this one. Everything that makes up a class is placed between the first brace { and its matching last brace }. The name of the class (and therefore the name of the file) is up to you. By convention the first letter of a class is typically upper case. If the class has a compound name each word in the name starts with a uppercase letter i.e. NumberAdder A source file always end with.java in lower case. Therefore the file name is ClassName.java In programming, the name for something like a class, a method or a variable is called an identifier. An identifier consists of alphabetical characters and digits, plus the two characters '_' and '$' - underscore and dollar sign The first character must be alphabetical, the remaining characters can be mixed alphabetic characters and digits or _ or $. No spaces are allowed inside the name. An expression is a sequence of symbols (identifiers, operators, constants, etc.) that denote a value 3*(2*x+y)-6*z 5

6 Key Terms and Defini/ons (4) A reserved word is a word like class that has a special meaning to the system. For example, class means that a definition of a class immediately follows. You must use reserved words only for their intended purpose. (For example, you can't use the word class for any other purpose than defining a class.) Page 25 0f the text lists reserved words A statement in a programming language is a command for the computer to do something. It is like a sentence of the language. A statement in Java is always followed by a semicolon. A group of statements within a set of braces is called a block We will learn that each block level defines a scope for the variables defined within that scope The part "Hello World!" is called a String. A String is a sequence of characters within double quotes. This program writes a String to the monitor and then stops. 6

7 Reserved Keywords In Java The table below lists all the words that are reserved Java. Words in red are those that we will be using this semester Notice that all the reserved words are lower case abstract assert boolean break byte case catch char class const* continue default double do else enum extends false final finally float for goto* if implements import instanceof int interface long native new null package private protected public return short static strictfp super switch synchronized this throw throws transient true try void volatile while *Even though goto and const are no longer used in the Java programming language, they still cannot be used. 7

8 Comments A single line comment begins with // This // can come at the beginning of the line or after a statement on the line : System.out.println("On a withered branch" ); // Write first line of the poem Multiline comments begin/* and end */ /* Program 1 Write out three lines of a poem. The poem describes a single moment in time, using 17 syllables. */ It is a good idea to fully comment your program This includes describing the logic, and defining your variables Using descriptive variable names makes this much easier 8

9 Data Types and Operators A data type is a set of values together with an associated set of operators for manipulating those values. Who can think of some basic data types in the numerical world? The logical world? When an identifier is used as a variable it always has a defined data type The meaning of the 0 s and 1 s in the computer depends on the data type being represented We will begin by defining the eight primitive data types byte, short, int, long, float, double, char and boolean all lower case 9

10 Data Types and Operators (2) All data in Java falls into one of two categories: primitive data types, and reference data types which refer to objects that are created from classes. There are only eight primitive data types - byte, short, int, long, float, double, char, and boolean. Reference data types are memory addresses that refer to objects Java has many different classes, and you can invent as many others as you need. Much more will be said about objects in future chapters (since Java is a object oriented programming language). The following is all you need to know, for now: A primitive data value uses a small, fixed number of bytes. There are only eight primitive data types. A programmer cannot create new primitive data types. 10

11 Some Notes on Objects An object is a big block of data. An object may use many bytes of memory. An object usually consists of many internal pieces. The data type of an object is called its class. Many classes are already defined in Java. A programmer can invent new classes to meet the particular needs of a program. We create classes and access the methods of those classes Some classes have static methods that are accessed without creating new objects We will see the differences as we move ahead 11

12 Primi/ve Numeric Data Types (1) Numbers are so important in Java that 6 of the 8 primitive data types are numeric types. There are both integer and floating point primitive types. There are 4 integer data types byte a single byte used for small integers short two bytes int 4 bytes all integers are assumed to be of type int long 8 bytes use for very large number 12

13 Primi/ve Numeric Data Types (2) There are two data types that are used for floating point numbers float - 4 bytes double - 8 bytes this is the default for all floating constants and is used in almost all cases for floating point arithmetic Floating point numbers, unlike integers, are not always precise. If you compare floating point numbers you can get errors or unexpected results when executing due to the way that they are represented in the computer Due to this lack of perfect precision we usually prefer to use double over float for real numbers that aren t integers, since the precision is greater, although still not perfect. As we will see shortly, there are casting issues when you mix numbers, especially with floating point numbers Java has advanced methods using objects to calculate numbers even more precisely This class called BigDecimal is used for very precise monetary and scientific calculations In the tables, E means "ten to the power of". So 3.5E38 means 3.5 x

14 Primi/ve Numeric Data Types (3) There is a fundamental difference between the the representations of integers and floating point numbers in the computer. Integer types have no fractional part; floating point types have a fractional part. On paper, integers have no decimal point, and floating point types do. But in main memory, there are no decimal points: even floating point values are represented with bit patterns. 14

15 Primi/ve Numeric Data Types (4) Each primitive type uses a fixed number of bytes. This means that if you are using a particular data type then the same number of bytes will be used no matter what value is represented. For example, all values represented using the short data type use 2 bytes (16 bits). The value zero (as a short) uses 2 bytes and the value thirty thousand uses 2 bytes. All values represented using the long data type use 8 bytes (64 bits). The value zero (as a long) uses 8 bytes, the value thirty thousand uses 8 bytes, and the value eight trillion uses 8 bytes. Values that are large in magnitude (negative or positive) need more bits to be represented. This is similar to writing out numbers on paper: large numbers need more digits. If a value needs more bits than a particular data type uses, then it cannot be represented using that data type. 15

16 Summary of PrimiJve Numeric Data Types Integer Primitive Data Types Type Size Range byte 1 byte (8 bits) -128 to +127 short 2 bytes (16 bits) -32,768 to +32,767 int long 4 bytes (32 bits) 8 bytes (64 bits) -2 billion to +2 billion (approximately) -9E18 to +9E18 (approximately) Remember: Integer data types reserve the leftmost bit to indicate positive (0) or negative (1) in two s complement format Floating Point Primitive Data Types Type Size Range float 4 bytes (32 bits) -3.4E38 to +3.4E38 double 8 bytes (64 bits) -1.7E308 to 1.7E308 In the tables, E means "ten to the power of". So 3.5E38 means 3.5 x

17 Numeric Operators (1) Operator Meaning Precedence - unary minus highest + unary plus highest * multiplication middle / division middle % remainder /modulus middle + addition low - subtraction low Precedence of operators can take the place of parentheses, but just as in algebra, you should use parentheses for clarity. Where there are no parentheses and equal precedence evaluation is from left to right 17

18 Numeric Operators (2) All of these operators can be used on floating point numbers and on integer numbers. The % operator is rarely used on floating point. (we won t be using it, but the remainder concept would be similar) When mixing floating point numbers and integer numbers, floating point takes precedence this is called casting An integer operation is always done with 32 bits or more. If one or both operand is 64 bits (data type long) then the operation is done with 64 bits. Otherwise the operation is done with 32 bits, even if both operands are of a lesser data type than 32 bits. For example, with 16 bit short variables, the arithmetic is done using 32 bits: 18

19 Integer ArithmeJc In integer arithmetic you always truncate 7/2 = 3 11/4 = 2 The modulus operator gives you the remainder 7%4 = 3 9%2 =? Any ideas on where the % can be helpful? Note: In Java the sign of the result of a%b is always the sign of a (the dividend). 19

20 CasJng Java is a highly type sensitive language When evaluating any expression with operands of different types Java first promotes or casts the operand of the smaller data type By smaller we mean the range byte is smaller than short which is smaller than int which is smaller than long which is smaller than float which is smaller than double boolean expressions are never cast char automatically casts up to int, not to short You can only cast downwards explicitly, otherwise you may create an error Example : int a =10; short b =5; a = b; This is casting upwards it is implicit and automatic b = (short)(a); This is casting downwards must be explicit 20

21 Mixing Numeric Data Types (1) If both operands are integers, then the operation is an integer operation. If any operand is double, then the operation is double = = = 14.4 (15/2) +7.4 =? (15%2) =? The numbers are casted upwards This becomes more important in the next chapter when we learn about typing variables Note: Unless otherwise declared all decimals are assumed to be of type double 21

22 Mixing Numeric Data Types (2) Remember that without parentheses you follow the hierarchy Mixed integer/decimal addition is cast to decimal when the mixing occurs (10.0+5) = /4*(18.0) = 36.0 (5/9) *( ) = 0.0 Note: Integers can be of type byte, short, int, long, but default to int However you can directly assign an int to a short or byte variable (if it fits with the range) short b =5; works Floating point numbers can be of type double or float, but default to double Example: float z; z = ; this creates an error Why? Java doesn t allow the double to cast down because of precision issues z = (float)( ); - This is correct we explicitly cast down. 22

23 Type boolean Type boolean identifiers can have only one of two values true or false. (1 or 0) A boolean value takes up a single byte. There are three operators && - means and both operands must be true for the value of the expression to be true - means or one of the operands must be true for the value of the expression to be true! - means not p q p&&q (and) p q (or)!p (not) true true true true false true false false true false false true false true true false false false false true 23

24 Type boolean Short CircuiJng There are also boolean operators & and What s the difference? When you use && or the compiler is more efficient, it can shortcircuit when necessary This means that once it determines if a statement is true or false it stops evaluating i.e.: (true false) false it is evaluated true after the first is evaluated (true && false) && true same idea, but evaluates as false after first && So when is there a problem: If you try to assign a logical value (allowed) this might not take place if there is short circuiting: (true false) (a= true) a doesn t get assigned the value true (a= true) is allowed as the expression evaluates as true (true false) (a= true) a does get assigned the value true Don t use these types of assignment statements inside of boolean statements it will inevitably lead to errors 24

25 Switches and Boolean Logic A A A X Y B To get from A to B both X and Y must be closed X&&Y X A B Y To get from A to B either X or Y must be closed X Y 25

26 RelaJonal Operators Operator Description Example (with A=2, B=5 == Checks if the value of two operands are equal or not, if yes then condition becomes true. (A == B) is not true.!= > Checks if the value of two operands are equal or not, if values are not equal then condition becomes true. Checks if the value of left operand is greater than the value of right operand, if yes then condition becomes true. (A!= B) is true. (A > B) is not true. < Checks if the value of left operand is less than the value of right operand, if yes then condition becomes true. (A < B) is true. >= <= Checks if the value of left operand is greater than or equal to the value of right operand, if yes then condition becomes true. Checks if the value of left operand is less than or equal to the value of right operand, if yes then condition becomes true. (A >= B) is not true. (A <= B) is true. The result of applying a relational operator is a true or false value 26

27 The hierarchy is very similar to what you know from algebra When there is an equivalent hierarchy level and no parentheses you evaluate from left to right When in doubt use parentheses Operator Hierarchy Priority Operators Operation Associativity [ ] array index 1 () method call left. member access ++ pre- or postfix increment -- pre- or postfix decrement + - unary plus, minus 2 ~ bitwise NOT right! boolean (logical) NOT (type) type cast new object creation 3 * / % multiplication, division, remainder left + - addition, subtraction 4 left + String concatenation << signed bit shift left 5 >> signed bit shift right left >>> unsigned bit shift right < <= less than, less than or equal to 6 > >= greater than, greater than or equal to left instanceof reference test == equal to 7 left!= not equal to & bitwise AND 8 left & boolean (logical) AND ^ bitwise XOR 9 left ^ boolean (logical) XOR bitwise OR 10 left boolean (logical) OR 11 && boolean (logical) AND left 12 boolean (logical) OR left 13? : conditional right = assignment *= /= += -= %= 14 right <<= >>= combinated assignment >>>= &= ^= = 27

28 Some Extra Examples 5>4 true 4>5 false (5>4) (4>5) -? (5>4) && (4>5) -? 28

29 Evaluate as true or false true false && 3 < 4!(5==7) Another Example (true (false && (3 < 4)))!(5==7) putting in the parentheses correctly always helps (true (false && true))!false (true false) true true true true 29

30 Type char Type char is the set of all characters found on the standard keyboard, and thousands of other characters as well. char is a primitive data type Type char is denoted using single quotes A, 5 Java uses Unicode 2 byte representations that increases the number of characters that can be represented from 255 to unique characters in actuality only 15 bits are used for two byte Unicode. Note: Keyboard letters in ASCII Code and Unicode have the same value i.e. A = 65 ie in ASCII or in Unicode You can add and subtract type char they are actually treated like integers when adding i.e. A +1 = 66 0r char would automatically cast up to int You could cast back down to char by saying (char)(66) which yields B They are added as type int 4bytes to accommodate all Unicode characters The most common characters and their Unicode values are found in Appendix B You can also compare type char values they compare based on their ASCII value ( A < B ) would evaluate as true 30

31 String String is a class in Java with lots of different methods that allows you to manipulate them An individual String is an object, not a basic data type. A String is a sequence of characters enclosed in double quotes Java provides a String class and we can create String objects Why does String have a capital S while primitive data types have lower case first letters String is the name of a class Strings can be concatenated I am + a man would evaluate as I am a man Strings and values Everything depends on the order The sum of two numbers is + (5*2) prints as The sum of two numbers is 10 Why? You always work from inside the parentheses outwards However ( The sum of two numbers is 5 ) + 2 prints as The sum of two numbers is 52 In Chapter 9 we do a lot more with String objects 31

32 Cas/ng With Strings and Characters A + B = 131 (integer) A + B = AB (String) A + B = AB (String) + A + B = AB (String) A gets cast to String A + B + = 131 (String) = 7 (String) = 34 (String) Key is that without parentheses we are reading left to right 32

33 PrinJng and Special Characters The System.out class is predefined and is included with the basic java.lang and therefore is always available for use. It is called the standard output object, and prints to the terminal We will learn how to print to other File objects later in this term We will be using two basic static methods from this class System.out.println( abc ) // prints the String and a character return System.out.print ( abc ) // prints a String without a character return Escape sequences inside the String can be used to control printing Escape Sequence Character \n newline \t tab \b backspace \f form feed \r return \" " (double quote) \' ' (single quote) \\ \ (back slash) \udddd character from the Unicode character set (DDDD is four hex digits) used when the character isn t available during input 33

34 PrinJng Example public class PrintAPoem { public static void main (String[] args) { System.out.println ( He wrote his code ); System.out.print( \the indented well\n ); System.out.println( \ttill he was done ); System.out.print( \nthe Author\n ); } } He wrote his code He indented well Till he was done The Author System.out.println(concatenated String) prints and goes to the next line System.out.print(concatenated String) prints and stays on the same line 34

35 PrinJng Example ConcatenaJon in Print Statements When you write expressions in a System.out.println() statement the expression may or may not be calculated first, depending on if and where you put the parentheses The rules are exactly the same as used when concatenating String(s) Ultimately the println method will output a single String public class PrintingNumbers //Class name { public static void main ( String[] args ) { System.out.println("The sum of is " + (5+6)); System.out.println("The sum of is " + 5+6); System.out.println("The sum of " +5 +" + " +6 + " is " +(5 + 6)); } } 35

36 Programming Exercise - Class (1) Modify the following program so that it s output is: Welcome To Java Programming public class Welcome1 { public static void main (String [] args) { System.out.println( Welcome To Java Programming ); } } 36

37 Programming Exercise - Class (2) Exercise 6. Triangle1Stars Write a program that prints the triangle: * ** *** **** ***** ****** Use this framework: public class Pname //Class name { public static void main ( String[] args ) //main method header } { } Code goes here //Body Compile with javac Pname.java Execute with java Pname once you compile successfully 37

38 Programming Exercise - Lab (1) Exercise 7. Triangle1StarsInits Write a program that prints the triangle: * ** *H* **G* ***R* ****** 38

39 Programming Exercise - Lab (2) Exercise 2. Uptime The uptime command of the UNIX operating system displays the number of days, hours and minutes since the operating system was started. For example the UNIX command uptime might return the string Up 53 days 12:39. Write a program that converts the 53 days, 12 hours and 39 minutes to the number of seconds that have elapsed since the operating since was last started. 39

Expressions and Data Types CSC 121 Fall 2015 Howard Rosenthal

Expressions 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 information

Expressions and Data Types CSC 121 Spring 2015 Howard Rosenthal

Expressions 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 information

CS5000: Foundations of Programming. Mingon Kang, PhD Computer Science, Kennesaw State University

CS5000: Foundations of Programming. Mingon Kang, PhD Computer Science, Kennesaw State University CS5000: Foundations of Programming Mingon Kang, PhD Computer Science, Kennesaw State University Overview of Source Code Components Comments Library declaration Classes Functions Variables Comments Can

More information

Program Fundamentals

Program Fundamentals Program Fundamentals /* HelloWorld.java * The classic Hello, world! program */ class HelloWorld { public static void main (String[ ] args) { System.out.println( Hello, world! ); } } /* HelloWorld.java

More information

CSC 1214: Object-Oriented Programming

CSC 1214: Object-Oriented Programming CSC 1214: Object-Oriented Programming J. Kizito Makerere University e-mail: jkizito@cis.mak.ac.ug www: http://serval.ug/~jona materials: http://serval.ug/~jona/materials/csc1214 e-learning environment:

More information

BIT Java Programming. Sem 1 Session 2011/12. Chapter 2 JAVA. basic

BIT Java Programming. Sem 1 Session 2011/12. Chapter 2 JAVA. basic BIT 3383 Java Programming Sem 1 Session 2011/12 Chapter 2 JAVA basic Objective: After this lesson, you should be able to: declare, initialize and use variables according to Java programming language guidelines

More information

Expressions, Data Types, Formatted Printing, Scanning CSC 123 Fall 2018 Howard Rosenthal

Expressions, Data Types, Formatted Printing, Scanning CSC 123 Fall 2018 Howard Rosenthal Expressions, Data Types, Formatted Printing, Scanning CSC 123 Fall 2018 Howard Rosenthal Lesson Goals Review the basic constructs of a Java Program Review simple Java data types and the operations on those

More information

Full file at

Full 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 information

3. Java - Language Constructs I

3. Java - Language Constructs I Educational Objectives 3. Java - Language Constructs I Names and Identifiers, Variables, Assignments, Constants, Datatypes, Operations, Evaluation of Expressions, Type Conversions You know the basic blocks

More information

JAVA Programming Fundamentals

JAVA Programming Fundamentals Chapter 4 JAVA Programming Fundamentals By: Deepak Bhinde PGT Comp.Sc. JAVA character set Character set is a set of valid characters that a language can recognize. It may be any letter, digit or any symbol

More information

COMP 202 Java in one week

COMP 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 information

Basics of Java Programming

Basics 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 information

CMPT 125: Lecture 3 Data and Expressions

CMPT 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 information

DEPARTMENT OF MATHS, MJ COLLEGE

DEPARTMENT OF MATHS, MJ COLLEGE T. Y. B.Sc. Mathematics MTH- 356 (A) : Programming in C Unit 1 : Basic Concepts Syllabus : Introduction, Character set, C token, Keywords, Constants, Variables, Data types, Symbolic constants, Over flow,

More information

Features of C. Portable Procedural / Modular Structured Language Statically typed Middle level language

Features 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 information

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

12/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 information

5/3/2006. Today! HelloWorld in BlueJ. HelloWorld in BlueJ, Cont. HelloWorld in BlueJ, Cont. HelloWorld in BlueJ, Cont. HelloWorld in BlueJ, Cont.

5/3/2006. Today! HelloWorld in BlueJ. HelloWorld in BlueJ, Cont. HelloWorld in BlueJ, Cont. HelloWorld in BlueJ, Cont. HelloWorld in BlueJ, Cont. Today! Build HelloWorld yourself in BlueJ and Eclipse. Look at all the Java keywords. Primitive Types. HelloWorld in BlueJ 1. Find BlueJ in the start menu, but start the Select VM program instead (you

More information

Objects and Types. COMS W1007 Introduction to Computer Science. Christopher Conway 29 May 2003

Objects and Types. COMS W1007 Introduction to Computer Science. Christopher Conway 29 May 2003 Objects and Types COMS W1007 Introduction to Computer Science Christopher Conway 29 May 2003 Java Programs A Java program contains at least one class definition. public class Hello { public static void

More information

A Java program contains at least one class definition.

A Java program contains at least one class definition. Java Programs Identifiers Objects and Types COMS W1007 Introduction to Computer Science Christopher Conway 29 May 2003 A Java program contains at least one class definition. public class Hello { public

More information

2 rd class Department of Programming. OOP with Java Programming

2 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 information

Java Notes. 10th ICSE. Saravanan Ganesh

Java Notes. 10th ICSE. Saravanan Ganesh Java Notes 10th ICSE Saravanan Ganesh 13 Java Character Set Character set is a set of valid characters that a language can recognise A character represents any letter, digit or any other sign Java uses

More information

Programming Lecture 3

Programming Lecture 3 Programming Lecture 3 Expressions (Chapter 3) Primitive types Aside: Context Free Grammars Constants, variables Identifiers Variable declarations Arithmetic expressions Operator precedence Assignment statements

More information

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. 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 information

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

Objectives. Chapter 2: Basic Elements of C++ Introduction. Objectives (cont d.) A C++ Program (cont d.) A C++ Program Objectives Chapter 2: Basic Elements of C++ In this chapter, you will: Become familiar with functions, special symbols, and identifiers in C++ Explore simple data types Discover how a program evaluates

More information

Chapter 2: Basic Elements of C++

Chapter 2: Basic Elements of C++ Chapter 2: Basic Elements of C++ Objectives In this chapter, you will: Become familiar with functions, special symbols, and identifiers in C++ Explore simple data types Discover how a program evaluates

More information

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

Chapter 2: Basic Elements of C++ Objectives. Objectives (cont d.) A C++ Program. Introduction Chapter 2: Basic Elements of C++ C++ Programming: From Problem Analysis to Program Design, Fifth Edition 1 Objectives In this chapter, you will: Become familiar with functions, special symbols, and identifiers

More information

Language Fundamentals Summary

Language Fundamentals Summary Language Fundamentals Summary Claudia Niederée, Joachim W. Schmidt, Michael Skusa Software Systems Institute Object-oriented Analysis and Design 1999/2000 c.niederee@tu-harburg.de http://www.sts.tu-harburg.de

More information

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

Computer Components. Software{ User Programs. Operating System. Hardware Computer Components Software{ User Programs Operating System Hardware What are Programs? Programs provide instructions for computers Similar to giving directions to a person who is trying to get from point

More information

LESSON 1. A C program is constructed as a sequence of characters. Among the characters that can be used in a program are:

LESSON 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 information

UNIT- 3 Introduction to C++

UNIT- 3 Introduction to C++ UNIT- 3 Introduction to C++ C++ Character Sets: Letters A-Z, a-z Digits 0-9 Special Symbols Space + - * / ^ \ ( ) [ ] =!= . $, ; : %! &? _ # = @ White Spaces Blank spaces, horizontal tab, carriage

More information

Accelerating Information Technology Innovation

Accelerating Information Technology Innovation Accelerating Information Technology Innovation http://aiti.mit.edu Cali, Colombia Summer 2012 Lesson 02 Variables and Operators Agenda Variables Types Naming Assignment Data Types Type casting Operators

More information

Chapter 3: Operators, Expressions and Type Conversion

Chapter 3: Operators, Expressions and Type Conversion 101 Chapter 3 Operators, Expressions and Type Conversion Chapter 3: Operators, Expressions and Type Conversion Objectives To use basic arithmetic operators. To use increment and decrement operators. To

More information

Getting started with Java

Getting started with Java Getting started with Java Magic Lines public class MagicLines { public static void main(string[] args) { } } Comments Comments are lines in your code that get ignored during execution. Good for leaving

More information

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

Computer Components. Software{ User Programs. Operating System. Hardware Computer Components Software{ User Programs Operating System Hardware What are Programs? Programs provide instructions for computers Similar to giving directions to a person who is trying to get from point

More information

cis20.1 design and implementation of software applications I fall 2007 lecture # I.2 topics: introduction to java, part 1

cis20.1 design and implementation of software applications I fall 2007 lecture # I.2 topics: introduction to java, part 1 topics: introduction to java, part 1 cis20.1 design and implementation of software applications I fall 2007 lecture # I.2 cis20.1-fall2007-sklar-leci.2 1 Java. Java is an object-oriented language: it is

More information

Lecture 2: Variables and Operators. AITI Nigeria Summer 2012 University of Lagos.

Lecture 2: Variables and Operators. AITI Nigeria Summer 2012 University of Lagos. Lecture 2: Variables and Operators AITI Nigeria Summer 2012 University of Lagos. Agenda Variables Types Naming Assignment Data Types Type casting Operators Declaring Variables in Java type name; Variables

More information

Last Time. University of British Columbia CPSC 111, Intro to Computation Alan J. Hu. Readings

Last Time. University of British Columbia CPSC 111, Intro to Computation Alan J. Hu. Readings University of British Columbia CPSC 111, Intro to Computation Alan J. Hu Writing a Simple Java Program Intro to Variables Readings Your textbook is Big Java (3rd Ed). This Week s Reading: Ch 2.1-2.5, Ch

More information

4 Programming Fundamentals. Introduction to Programming 1 1

4 Programming Fundamentals. Introduction to Programming 1 1 4 Programming Fundamentals Introduction to Programming 1 1 Objectives At the end of the lesson, the student should be able to: Identify the basic parts of a Java program Differentiate among Java literals,

More information

CSCI 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 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 information

Le L c e t c ur u e e 2 To T p o i p c i s c t o o b e b e co c v o e v r e ed e Variables Operators

Le L c e t c ur u e e 2 To T p o i p c i s c t o o b e b e co c v o e v r e ed e Variables Operators Course Name: Advanced Java Lecture 2 Topics to be covered Variables Operators Variables -Introduction A variables can be considered as a name given to the location in memory where values are stored. One

More information

Fundamental of Programming (C)

Fundamental of Programming (C) Borrowed from lecturer notes by Omid Jafarinezhad Fundamental of Programming (C) Lecturer: Vahid Khodabakhshi Lecture 3 Constants, Variables, Data Types, And Operations Department of Computer Engineering

More information

A variable is a name that represents a value. For

A variable is a name that represents a value. For DECLARE A VARIABLE A variable is a name that represents a value. For example, you could have the variable myage represent the value 29. Variables can be used to perform many types of calculations. Before

More information

Java Identifiers. Java Language Essentials. Java Keywords. Java Applications have Class. Slide Set 2: Java Essentials. Copyright 2012 R.M.

Java Identifiers. Java Language Essentials. Java Keywords. Java Applications have Class. Slide Set 2: Java Essentials. Copyright 2012 R.M. Java Language Essentials Java is Case Sensitive All Keywords are lower case White space characters are ignored Spaces, tabs, new lines Java statements must end with a semicolon ; Compound statements use

More information

An overview of Java, Data types and variables

An 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 information

BASIC ELEMENTS OF A COMPUTER PROGRAM

BASIC ELEMENTS OF A COMPUTER PROGRAM BASIC ELEMENTS OF A COMPUTER PROGRAM CSC128 FUNDAMENTALS OF COMPUTER PROBLEM SOLVING LOGO Contents 1 Identifier 2 3 Rules for naming and declaring data variables Basic data types 4 Arithmetic operators

More information

Visual C# Instructor s Manual Table of Contents

Visual C# Instructor s Manual Table of Contents Visual C# 2005 2-1 Chapter 2 Using Data At a Glance Instructor s Manual Table of Contents Overview Objectives s Quick Quizzes Class Discussion Topics Additional Projects Additional Resources Key Terms

More information

Java Programming Fundamentals. Visit for more.

Java Programming Fundamentals. Visit  for more. Chapter 4: Java Programming Fundamentals Informatics Practices Class XI (CBSE Board) Revised as per CBSE Curriculum 2015 Visit www.ip4you.blogspot.com for more. Authored By:- Rajesh Kumar Mishra, PGT (Comp.Sc.)

More information

Data and Variables. Data Types Expressions. String Concatenation Variables Declaration Assignment Shorthand operators. Operators Precedence

Data and Variables. Data Types Expressions. String Concatenation Variables Declaration Assignment Shorthand operators. Operators Precedence Data and Variables Data Types Expressions Operators Precedence String Concatenation Variables Declaration Assignment Shorthand operators Review class All code in a java file is written in a class public

More information

Declaration and Memory

Declaration and Memory Declaration and Memory With the declaration int width; the compiler will set aside a 4-byte (32-bit) block of memory (see right) The compiler has a symbol table, which will have an entry such as Identifier

More information

Values and Variables 1 / 30

Values and Variables 1 / 30 Values and Variables 1 / 30 Values 2 / 30 Computing Computing is any purposeful activity that marries the representation of some dynamic domain with the representation of some dynamic machine that provides

More information

A complex expression to evaluate we need to reduce it to a series of simple expressions. E.g * 7 =>2+ 35 => 37. E.g.

A complex expression to evaluate we need to reduce it to a series of simple expressions. E.g * 7 =>2+ 35 => 37. E.g. 1.3a Expressions Expressions An Expression is a sequence of operands and operators that reduces to a single value. An operator is a syntactical token that requires an action be taken An operand is an object

More information

CSc 10200! Introduction to Computing. Lecture 2-3 Edgardo Molina Fall 2013 City College of New York

CSc 10200! Introduction to Computing. Lecture 2-3 Edgardo Molina Fall 2013 City College of New York CSc 10200! Introduction to Computing Lecture 2-3 Edgardo Molina Fall 2013 City College of New York 1 C++ for Engineers and Scientists Third Edition Chapter 2 Problem Solving Using C++ 2 Objectives In this

More information

Introduction to C# Applications

Introduction to C# Applications 1 2 3 Introduction to C# Applications OBJECTIVES To write simple C# applications To write statements that input and output data to the screen. To declare and use data of various types. To write decision-making

More information

Object oriented programming. Instructor: Masoud Asghari Web page: Ch: 3

Object 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 information

Chapter 2. Elementary Programming

Chapter 2. Elementary Programming Chapter 2 Elementary Programming 1 Objectives To write Java programs to perform simple calculations To obtain input from the console using the Scanner class To use identifiers to name variables, constants,

More information

SECTION II: LANGUAGE BASICS

SECTION II: LANGUAGE BASICS Chapter 5 SECTION II: LANGUAGE BASICS Operators Chapter 04: Basic Fundamentals demonstrated declaring and initializing variables. This chapter depicts how to do something with them, using operators. Operators

More information

Fundamentals of Programming

Fundamentals of Programming Fundamentals of Programming Lecture 3 - Constants, Variables, Data Types, And Operations Lecturer : Ebrahim Jahandar Borrowed from lecturer notes by Omid Jafarinezhad Outline C Program Data types Variables

More information

ECE 122 Engineering Problem Solving with Java

ECE 122 Engineering Problem Solving with Java ECE 122 Engineering Problem Solving with Java Lecture 3 Expression Evaluation and Program Interaction Outline Problem: How do I input data and use it in complicated expressions Creating complicated expressions

More information

Operators. Java operators are classified into three categories:

Operators. Java operators are classified into three categories: Operators Operators are symbols that perform arithmetic and logical operations on operands and provide a meaningful result. Operands are data values (variables or constants) which are involved in operations.

More information

Lecture 2. COMP1406/1006 (the Java course) Fall M. Jason Hinek Carleton University

Lecture 2. COMP1406/1006 (the Java course) Fall M. Jason Hinek Carleton University Lecture 2 COMP1406/1006 (the Java course) Fall 2013 M. Jason Hinek Carleton University today s agenda a quick look back (last Thursday) assignment 0 is posted and is due this Friday at 2pm Java compiling

More information

Data and Expressions. Outline. Data and Expressions 12/18/2010. Let's explore some other fundamental programming concepts. Chapter 2 focuses on:

Data and Expressions. Outline. Data and Expressions 12/18/2010. Let's explore some other fundamental programming concepts. Chapter 2 focuses on: Data and Expressions Data and Expressions Let's explore some other fundamental programming concepts Chapter 2 focuses on: Character Strings Primitive Data The Declaration And Use Of Variables Expressions

More information

CHAPTER 2 Java Fundamentals

CHAPTER 2 Java Fundamentals CHAPTER 2 Java Fundamentals Copyright 2016 Pearson Education, Inc., Hoboken NJ Chapter Topics Chapter 2 discusses the following main topics: The Parts of a Java Program The print and println Methods, and

More information

Character Set. The character set of C represents alphabet, digit or any symbol used to represent information. Digits 0, 1, 2, 3, 9

Character Set. The character set of C represents alphabet, digit or any symbol used to represent information. Digits 0, 1, 2, 3, 9 Character Set The character set of C represents alphabet, digit or any symbol used to represent information. Types Uppercase Alphabets Lowercase Alphabets Character Set A, B, C, Y, Z a, b, c, y, z Digits

More information

The Java Language Rules And Tools 3

The Java Language Rules And Tools 3 The Java Language Rules And Tools 3 Course Map This module presents the language and syntax rules of the Java programming language. You will learn more about the structure of the Java program, how to insert

More information

Programming with Java

Programming with Java Programming with Java Data Types & Input Statement Lecture 04 First stage Software Engineering Dep. Saman M. Omer 2017-2018 Objectives q By the end of this lecture you should be able to : ü Know rules

More information

Tools : The Java Compiler. The Java Interpreter. The Java Debugger

Tools : The Java Compiler. The Java Interpreter. The Java Debugger Tools : The Java Compiler javac [ options ] filename.java... -depend: Causes recompilation of class files on which the source files given as command line arguments recursively depend. -O: Optimizes code,

More information

Course Outline. Introduction to java

Course 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 information

The Arithmetic Operators. Unary Operators. Relational Operators. Examples of use of ++ and

The Arithmetic Operators. Unary Operators. Relational Operators. Examples of use of ++ and The Arithmetic Operators The arithmetic operators refer to the standard mathematical operators: addition, subtraction, multiplication, division and modulus. Op. Use Description + x + y adds x and y x y

More information

C: How to Program. Week /Mar/05

C: 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 information

The Arithmetic Operators

The Arithmetic Operators The Arithmetic Operators The arithmetic operators refer to the standard mathematical operators: addition, subtraction, multiplication, division and modulus. Examples: Op. Use Description + x + y adds x

More information

CS113: Lecture 3. Topics: Variables. Data types. Arithmetic and Bitwise Operators. Order of Evaluation

CS113: Lecture 3. Topics: Variables. Data types. Arithmetic and Bitwise Operators. Order of Evaluation CS113: Lecture 3 Topics: Variables Data types Arithmetic and Bitwise Operators Order of Evaluation 1 Variables Names of variables: Composed of letters, digits, and the underscore ( ) character. (NO spaces;

More information

Chapter 2 Elementary Programming

Chapter 2 Elementary Programming Chapter 2 Elementary Programming Part I 1 Motivations In the preceding chapter, you learned how to create, compile, and run a Java program. Starting from this chapter, you will learn how to solve practical

More information

JAVA OPERATORS GENERAL

JAVA OPERATORS GENERAL JAVA OPERATORS GENERAL Java provides a rich set of operators to manipulate variables. We can divide all the Java operators into the following groups: Arithmetic Operators Relational Operators Bitwise Operators

More information

CONTENTS: Compilation Data and Expressions COMP 202. More on Chapter 2

CONTENTS: Compilation Data and Expressions COMP 202. More on Chapter 2 CONTENTS: Compilation Data and Expressions COMP 202 More on Chapter 2 Programming Language Levels There are many programming language levels: machine language assembly language high-level language Java,

More information

Entry Point of Execution: the main Method. Elementary Programming. Learning Outcomes. Development Process

Entry 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 information

Lecture Notes. System.out.println( Circle radius: + radius + area: + area); radius radius area area value

Lecture Notes. System.out.println( Circle radius: + radius + area: + area); radius radius area area value Lecture Notes 1. Comments a. /* */ b. // 2. Program Structures a. public class ComputeArea { public static void main(string[ ] args) { // input radius // compute area algorithm // output area Actions to

More information

Chapter 2: Data and Expressions

Chapter 2: Data and Expressions Chapter 2: Data and Expressions CS 121 Department of Computer Science College of Engineering Boise State University January 15, 2015 Chapter 2: Data and Expressions CS 121 1 / 1 Chapter 2 Part 1: Data

More information

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

For the course, we will be using JCreator as the IDE (Integrated Development Environment). For the course, we will be using JCreator as the IDE (Integrated Development Environment). We strongly advise that you install these to your own computers. If you do not have your own computer, the computer

More information

Lecture Set 2: Starting Java

Lecture Set 2: Starting Java Lecture Set 2: Starting Java 1. Java Concepts 2. Java Programming Basics 3. User output 4. Variables and types 5. Expressions 6. User input 7. Uninitialized Variables 0 This Course: Intro to Procedural

More information

C OVERVIEW BASIC C PROGRAM STRUCTURE. C Overview. Basic C Program Structure

C OVERVIEW BASIC C PROGRAM STRUCTURE. C Overview. Basic C Program Structure C Overview Basic C Program Structure C OVERVIEW BASIC C PROGRAM STRUCTURE Goals The function main( )is found in every C program and is where every C program begins speed execution portability C uses braces

More information

Chapter 2: Using Data

Chapter 2: Using Data Chapter 2: Using Data Declaring Variables Constant Cannot be changed after a program is compiled Variable A named location in computer memory that can hold different values at different points in time

More information

Objectives. In this chapter, you will:

Objectives. In this chapter, you will: Objectives In this chapter, you will: Become familiar with functions, special symbols, and identifiers in C++ Explore simple data types Discover how a program evaluates arithmetic expressions Learn about

More information

Object-Oriented Programming

Object-Oriented Programming Object-Oriented Programming Java Syntax Program Structure Variables and basic data types. Industry standard naming conventions. Java syntax and coding conventions If Then Else Case statements Looping (for,

More information

DM550 / DM857 Introduction to Programming. Peter Schneider-Kamp

DM550 / DM857 Introduction to Programming. Peter Schneider-Kamp DM550 / DM857 Introduction to Programming Peter Schneider-Kamp petersk@imada.sdu.dk http://imada.sdu.dk/~petersk/dm550/ http://imada.sdu.dk/~petersk/dm857/ OBJECT-ORIENTED PROGRAMMING IN JAVA 2 Programming

More information

Lecture Set 2: Starting Java

Lecture Set 2: Starting Java Lecture Set 2: Starting Java 1. Java Concepts 2. Java Programming Basics 3. User output 4. Variables and types 5. Expressions 6. User input 7. Uninitialized Variables 0 This Course: Intro to Procedural

More information

Welcome to CSE 142! Whitaker Brand. University of Washington, Winter 2018

Welcome 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 information

CS102: Variables and Expressions

CS102: Variables and Expressions CS102: Variables and Expressions The topic of variables is one of the most important in C or any other high-level programming language. We will start with a simple example: int x; printf("the value of

More information

Chapter 2: Data and Expressions

Chapter 2: Data and Expressions Chapter 2: Data and Expressions CS 121 Department of Computer Science College of Engineering Boise State University April 21, 2015 Chapter 2: Data and Expressions CS 121 1 / 53 Chapter 2 Part 1: Data Types

More information

Chapter 2: Data and Expressions

Chapter 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 information

ANSI C Programming Simple Programs

ANSI C Programming Simple Programs ANSI C Programming Simple Programs /* This program computes the distance between two points */ #include #include #include main() { /* Declare and initialize variables */ double

More information

Tester vs. Controller. Elementary Programming. Learning Outcomes. Compile Time vs. Run Time

Tester 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 information

UNIT - I. Introduction to C Programming. BY A. Vijay Bharath

UNIT - I. Introduction to C Programming. BY A. Vijay Bharath UNIT - I Introduction to C Programming Introduction to C C was originally developed in the year 1970s by Dennis Ritchie at Bell Laboratories, Inc. C is a general-purpose programming language. It has been

More information

C OVERVIEW. C Overview. Goals speed portability allow access to features of the architecture speed

C OVERVIEW. C Overview. Goals speed portability allow access to features of the architecture speed C Overview C OVERVIEW Goals speed portability allow access to features of the architecture speed C fast executables allows high-level structure without losing access to machine features many popular languages

More information

Programming in C++ 5. Integral data types

Programming in C++ 5. Integral data types Programming in C++ 5. Integral data types! Introduction! Type int! Integer multiplication & division! Increment & decrement operators! Associativity & precedence of operators! Some common operators! Long

More information

Outline. Parts 1 to 3 introduce and sketch out the ideas of OOP. Part 5 deals with these ideas in closer detail.

Outline. Parts 1 to 3 introduce and sketch out the ideas of OOP. Part 5 deals with these ideas in closer detail. OOP in Java 1 Outline 1. Getting started, primitive data types and control structures 2. Classes and objects 3. Extending classes 4. Using some standard packages 5. OOP revisited Parts 1 to 3 introduce

More information

3. Java - Language Constructs I

3. Java - Language Constructs I Names and Identifiers A program (that is, a class) needs a name public class SudokuSolver {... 3. Java - Language Constructs I Names and Identifiers, Variables, Assignments, Constants, Datatypes, Operations,

More information

Welcome 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 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 information

Elementary Programming

Elementary 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 information

Introduction To Java. Chapter 1. Origins of the Java Language. Origins of the Java Language. Objects and Methods. Origins of the Java Language

Introduction 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 information

Weiss Chapter 1 terminology (parenthesized numbers are page numbers)

Weiss Chapter 1 terminology (parenthesized numbers are page numbers) Weiss Chapter 1 terminology (parenthesized numbers are page numbers) assignment operators In Java, used to alter the value of a variable. These operators include =, +=, -=, *=, and /=. (9) autoincrement

More information