Programming Lecture 3

Size: px
Start display at page:

Download "Programming Lecture 3"

Transcription

1 Five-Minute Review 1. What is a variable? 2. What is a class? An object? 3. What is a package? 4. What is a method? A constructor? 5. What is an object variable? 1

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

3 C H A P T E R 3 Expressions What s twice eleven? I said to Pooh. ( Twice what? said Pooh to Me.) I think that it ought to be twenty-two. Just what I think myself, said Pooh. A. A. Milne, Now We Are Six, 1927 The Art and Science of ERIC S. ROBERTS Java An Introduction to Computer Science 3.1 Primitive data types 3.2 Constants and variables 3.3 Operators and operands 3.4 Assignment statements 3.5 Boolean expressions 3.6 Designing for change 3

4 Aside: Context-Free Grammars (CFGs) Can specify syntax of a program (or parts of a program) as CFG As some other material, this is not fully covered in the book, but still part of the class content. For further reference, see e.g.: 4

5 Why You Should Care About CFGs The Java Language Specification Table of Contents 1. Introduction 1.1. Organization of the Specification 1.2. Example Programs 1.3. Notation 1.4. Relationship to Predefined Classes and Interfaces 1.5. Feedback 1.6. References 2. Grammars 2.1. Context-Free Grammars 2.2. The Lexical Grammar 2.3. The Syntactic Grammar 2.4. Grammar Notation... The Java Language Specification The Java Language Specification The Java Language Specification Next Separators Operators Integral Types and Values Integer Operations Floating Point Types, Formats, and Values Floating Point Operations The boolean Type and boolean Values Bill Joy Guy Steele Daniel Smith 3. Lexical Structure The Java Language Specification Access Control Determining Accessibility Details on protected Access The Java Language Specification Static Member Type Declarations The Java Language Specification When Initialization Occurs Detailed Initialization Procedure 8.9. Enum Types Enum Constants Enum Body Declarations Enum Members The Kinds of Exceptions The Causes of Exceptions Asynchronous Exceptions Interface Modifiers abstract Interfaces strictfp Interfaces Compile Time Checking of Exceptions Exception Analysis of Expressions Exception Analysis of Statements Exception Checking Generic Interfaces and Type Parameters Superinterfaces and Subinterfaces Interface Body and Member Declarations Java Virtual Machine Startup Load the Class Test Link Test: Verify, Prepare, (Optionally) Resolve Initialize Test: Execute Initializers Invoke Test.main Inheritance and Overriding Overriding (by Instance Methods) Requirements in Overriding Inheriting Methods with Override Equivalent Signatures /15 The Java Language Specification Integer Bitwise Operators &, ^, and Boolean Logical Operators &, ^, and Method Invocation Expressions Lambda Parameters Lambda Body Type of a Lambda Expression Run Time Evaluation of Lambda Expressions Constant Expressions Boolean Constant Expressions Conditional And Operator && Conditional Or Operator Logical Complement Operator! Conditional Operator? : Conditional Operator? : Other Expressions of Type boolean Assignment Expressions Operators ++ and Other Expressions Expression Names Postfix Increment Operator Postfix Decrement Operator Prefix Increment Operator Prefix Decrement Operator Unary Plus Operator Unary Minus Operator Bitwise Complement Operator ~ Logical Complement Operator! Word Tearing Non Atomic Treatment of double and long 18. Type Inference Concepts and Notation Inference Variables Constraint Formulas Bounds Definite Assignment and Statements Empty Statements Blocks Local Class Declaration Statements Cast Expressions Semantics of final Fields Reading final Fields During Construction Subsequent Modification of final Fields Write Protected Fields Definite Assignment and Expressions Unary Operators 9/15 The Java Language Specification Reduction Expression Compatibility Constraints 10/15 The Java Language Specification 13/ / /15 The Java Language Specification Enhanced for And Arrays Enhanced for And Unboxing Conversion The break Statement The continue Statement The synchronized Statement Catching An Exception Handling An Uncaught Exception With finally Conditional Compilation Left Hand Operand Is Evaluated First Implicit Left Hand Operand In Operator Of Compound Assigment Abrupt Completion of Evaluation of the Left Hand Operand Evaluation of Operands Before Operation Evaluation Order At Method Invocation Abrupt Completion of Argument Expression The this Expression Evaluation Order and Out Of Memory Detection Array Creation Evaluation Multi Dimensional Array Creation OutOfMemoryError and Dimension Expression Evaluation Array Reference Is Evaluated First Abrupt Completion of Array Reference Evaluation null Array Reference Static Binding for Field Access Receiver Variable Is Irrelevant For static Field Access The super Expression Method Applicability Return Type Not Considered During Method Selection Choosing The Most Specific Method Target References and static Methods Evaluation Order During Method Invocation Overriding and Method Invocation Method Invocation Using super Invoked Method Signature Has Different Erasure Than Compile Time Method Signature Integer Remainder Operator Floating Point Remainder Operator String Concatenation String Concatenation and Conditionals The instanceof Operator Simple Assignment To An Array Component Compound Assignment To An Array Component Value Of Left Hand Side Of Compound Assignment Is Saved Before Evaluation Of Right Hand Side Constant Expressions Definite Assignment Considers Structure of Statements and Expressions Definite Assignment Does Not Consider Values of Expressions Definite Unassignment Incorrectly Synchronized Programs May Exhibit Surprising Behavior Happens before Consistency Happens before Consistency Is Not Sufficient final Fields In The Java Memory Model final Fields For Security Aggressive Optimization of final Fields Detection of Word Tearing Overloading Overloading, Overriding, and Hiding Constructor Declarations Constructor Bodies Restrictions on Explicit Constructor Invocation Statements Qualified Superclass Constructor Invocation Default Constructors Accessibility of Constructors v. Classes Preventing Instantiation via Constructor Accessibility Enum Body Declarations Restriction On Enum Constant Self Reference Iterating Over Enum Constants With An Enhanced for Loop Switching Over Enum Constants Enum Constants with Class Bodies Multiple Enum Types Ambiguous Inherited Fields Multiply Inherited Fields Forward Reference to a Field Overloading an abstract Method Declaration Annotation Type Declaration Marker Annotation Type Declaration Single Element Annotation Type Declarations Annotation Type Declaration With Default Values Ill formed Containing Annotation Type Restricting Where Annotations May Repeat A Repeatable Containing Annotation Type Normal Annotations Marker Annotations Single Element Annotations Functional Interfaces Functional Interfaces and Erasure Generic Functional Interfaces Function Types Generic Function Types Declarations of Array Variables Array Variables and Array Types Array Access ArrayStoreException Array Initializers Arrays Are Cloneable Shared Subarrays After A Clone Class Object Of Array Array Class Objects Are Shared Catching Checked Exceptions Throwing and Catching Exceptions Superclasses Are Initialized Before Subclasses Only The Class That Declares static Field Is Initialized Interface Initialization Does Not Initialize Superinterfaces Evaluation of Instance Creation Dynamic Dispatch During Instance Creation Changing A Superclass Changing A Class Body Changing A Superclass Changing Accessibility Adding A Field Declaration Changing A Variable To Be final Changing A Method To Be abstract Changing A Method To Be final Adding An Overloaded Method Deleting An Interface Member Adding A Default Method Local Class Declarations Labels and Identifiers Fall Through in the switch Statement The do Statement Qualified Type Names Simple Expression Names Qualified Expression Names Qualifying an Expression with a Type Name Simple Method Names Access Control Access to public Fields, Methods, and Constructors Access to public and Non public Classes Access to Package Access Fields, Methods, and Constructors Access to private Fields, Methods, and Constructors Access to protected Fields, Methods, and Constructors Fully Qualified Names Fully Qualified Names v. Canonical Name Unnamed Package Single Type Import Duplicate Type Declarations No Import of a Subpackage Importing a Type Name that is also a Package Name Type Import on Demand Conflicting Top Level Type Declarations Scope of Top Level Types Fully Qualified Names Resolution of requires transitive directives Abstract Class Declaration Abstract Class Declaration that Prohibits Subclasses Mutually Recursive Type Variable Bounds Nested Generic Classes Inner Class Declarations and Static Members Inner Class Declarations Direct Superclasses and Subclasses Superclasses and Subclasses Class Depends on Itself Illegal Superinterfaces Superinterfaces Illegal Multiple Inheritance of an Interface Implementing Methods of a Superinterface Use of Class Members Inheritance of Class Members with Package Access Inheritance of public and protected Class Members Inheritance of private Class Members Accessing Members of Inaccessible Classes Multiply Inherited Fields Re inheritance of Fields static Fields Hiding of Class Variables Hiding of Instance Variables Persistence of transient Fields volatile Fields Field Initialization Forward Reference to a Class Variable Restrictions on Field References Override Equivalent Signatures Abstract/Abstract Method Overriding Abstract/Non Abstract Overriding synchronized Monitors synchronized Methods Type Variables as Thrown Exception Types Inheritance Overriding Overriding Invocation of Hidden Class Methods Covariant Return Types Unchecked Warning from Return Type Incorrect Overriding because of throws Erasure Affects Overriding String Literals Integer Operations Floating point Operations Object Creation Primitive and Reference Identity Members of a Type Variable Unbounded Wildcards Bounded Wildcards Raw Types Raw Types and Inheritance Usage of a Type Different Kinds of Variables Final Variables Initial Values of Variables Type of a Variable versus Class of an Object Conversions at Compile Time and Run Time Conversions In Various Contexts Widening Primitive Conversion Narrowing Primitive Conversion Narrowing Primitive Conversions that lose information Assignment for Primitive Types Assignment for Reference Types Assignment for Array Types Casting for Reference Types Casting for Array Types Casting Incompatible Types at Run Time Unary Numeric Promotion Binary Numeric Promotion Unique Package Names Unique Module Names Descriptive Class Names Conventional Type Variable Names Scope of Type Declarations Scope of Local Variable Declarations Attempted Shadowing Of A Local Variable Shadowing of a Field Declaration by a Local Variable Declaration Shadowing of a Type Declaration by Another Type Declaration Reclassification of Contextually Ambiguous Names final Field Semantics 16. Definite Assignment Postfix Expressions List of Examples Shared Variables Actions Programs and Program Order Synchronization Order Happens before Order Executions Well Formed Executions Executions and Causality Requirements Observable Behavior and Nonterminating Executions Lambda Expressions Compute Target Reference (If Necessary) Evaluate Arguments Check Accessibility of Type and Method Locate Method to Invoke Create Frame, Synchronize, Transfer Control Compile Time Declaration of a Method Reference Type of a Method Reference Run Time Evaluation of Method References Poly Method Invocation Compatibility Additional Argument Constraints Functional Interface Parameterization Inference More Specific Method Inference Sleep and Yield Memory Model Simple Assignment Operator = Compound Assignment Operators Method Reference Expressions Invocation Applicability Inference Invocation Type Inference 19. Syntax Index A. Limited License Grant Wait Notification Interruptions Interactions of Waits, Notification, and Interruption Assignment Operators Compile Time Step 3: Is the Chosen Method Appropriate? Run Time Evaluation of Method Invocation Resolution Uses of Inference Synchronization Wait Sets and Notification Boolean Conditional Expressions Numeric Conditional Expressions Reference Conditional Expressions Identify Potentially Applicable Methods Phase 1: Identify Matching Arity Methods Applicable by Strict Invocation Phase 2: Identify Matching Arity Methods Applicable by Loose Invocation Phase 3: Identify Methods Applicable by Variable Arity Invocation Choosing the Most Specific Method Method Invocation Type Complementary Pairs of Bounds Bounds Involving Capture Conversion 17. Threads and Locks Conditional And Operator && Conditional Or Operator Conditional Operator? : Compile Time Step 1: Determine Class or Interface to Search Compile Time Step 2: Determine Method Signature The Java Language Specification Type Compatibility Constraints Subtyping Constraints Type Equality Constraints Checked Exception Constraints Initialization Part of for Statement Incrementation Part of for Statement Bitwise and Logical Operators Field Access Using a Primary Accessing Superclass Members using super 8/ Incorporation Definite Assignment and Parameters Definite Assignment and Array Initializers Definite Assignment and Enum Constants Definite Assignment and Anonymous Classes Definite Assignment and Member Types Definite Assignment and Static Initializers Definite Assignment, Constructors, and Instance Initializers Numerical Equality Operators == and!= Boolean Equality Operators == and!= Reference Equality Operators == and!= break, continue, return, and throw Statements synchronized Statements try Statements Numerical Comparison Operators <, <=, >, and >= Type Comparison Operator instanceof Equality Operators Field Access Expressions Lexical Literals The Java Language Specification Shift Operators Relational Operators Anonymous Constructors Evaluate Left Hand Operand First Evaluate Operands before Operation Evaluation Respects Parentheses and Precedence Argument Lists are Evaluated Left to Right Evaluation Order for Other Expressions Primary Expressions 7/ Local Variable Declaration Statements Labeled Statements Expression Statements if Statements assert Statements switch Statements while Statements do Statements for Statements String Concatenation Operator Additive Operators (+ and -) for Numeric Types Array Creation Expressions Run Time Evaluation of Array Creation Expressions Array Access Expressions Run Time Evaluation of Array Access Expressions The Java Language Specification Multiplication Operator * Division Operator / Remainder Operator % Array Creation and Access Expressions Basic try with resources Extended try with resources Evaluation, Denotation, and Result Forms of Expressions Type of an Expression FP strict Expressions Expressions and Run Time Checks Normal and Abrupt Completion of Evaluation Evaluation Order Additive Operators Determining the Class being Instantiated Determining Enclosing Instances Choosing the Constructor and its Arguments Run Time Evaluation of Class Instance Creation Expressions Anonymous Class Declarations / Multiplicative Operators Class Literals this Qualified this Parenthesized Expressions Class Instance Creation Expressions Execution of try catch Execution of try finally and try catch finally try with resources Unreachable Statements 15. Expressions Normal and Abrupt Completion of Statements Blocks The Loading Process Initialization of for Statement Iteration of for Statement Abrupt Completion of for Statement The enhanced for statement 14. Blocks and Statements Loading of Classes and Interfaces Overloading Interface Method Body The basic for Statement The break Statement The continue Statement The return Statement The throw Statement The synchronized Statement The try statement public Interfaces Superinterfaces Interface Members Interface Type Parameters Field Declarations Interface Method Declarations Evolution of Annotation Types 12. Execution Initialization of Fields in Interfaces 9.4. Method Declarations Abrupt Completion of do Statement The for Statement Evolution of Interfaces Run Time Handling of an Exception 9.2. Interface Members 9.3. Field (Constant) Declarations Abrupt Completion of while Statement The do Statement abstract Classes final Classes public Classes Superclasses and Superinterfaces Class Type Parameters Class Body and Member Declarations Access to Members and Constructors Field Declarations final Fields and static Constant Variables static Fields transient Fields Method and Constructor Declarations Method and Constructor Type Parameters Method and Constructor Formal Parameters Method Result Type abstract Methods final Methods native Methods static Methods synchronized Methods Method and Constructor Throws Method and Constructor Body Method and Constructor Overloading Method Overriding Static Initializers Evolution of Enums The Kinds and Causes of Exceptions 9.1. Interface Declarations The assert Statement The switch Statement The while Statement The Form of a Binary What Binary Compatibility Is and Is Not Evolution of Packages and Modules Evolution of Classes 11. Exceptions 9. Interfaces The if then Statement The if then else Statement Implementing Finalization Interaction with the Memory Model 13. Binary Compatibility Array Types Array Variables Array Creation Array Access Array Store Exception Array Initializers Array Members Class Objects for Arrays An Array of Characters Is Not a String The Java Language Specification Local Variable Declarators and Types Execution of Local Variable Declarations Statements The Empty Statement Labeled Statements Expression Statements The if Statement Unloading of Classes and Interfaces Program Exit 10. Arrays 4/ Local Class Declarations Local Variable Declaration Statements Creation of New Class Instances Finalization of Class Instances 9.8. Functional Interfaces 9.9. Function Types Explicit Constructor Invocations Verification of the Binary Representation Preparation of a Class or Interface Type Resolution of Symbolic References Normal Annotations Marker Annotations Single Element Annotations Where Annotations May Appear Multiple Annotations of the Same Type Constructor Overloading Default Constructor Preventing Instantiation of a Class Initialization of Classes and Interfaces 9.7. Annotations Formal Parameters Constructor Signature Constructor Modifiers Generic Constructors Constructor Throws The Type of a Constructor Constructor Body 3/ Linking of Classes and Interfaces Overriding (by Instance Methods) Hiding (by Class Methods) Requirements in Overriding and Hiding Inheriting Methods with Override Equivalent Signatures Overloading 8.6. Instance Initializers 8.7. Static Initializers 8.8. Constructor Declarations abstract Methods static Methods final Methods native Methods strictfp Methods Access to a protected Member Access to a protected Constructor 2/ Annotation Type Elements Defaults for Annotation Type Elements Repeatable Annotation Types Predefined Annotation Types 8.5. Member Type Declarations Formal Parameters Method Signature Method Modifiers Simple Method Names 9.5. Member Type Declarations 9.6. Annotation Types synchronized Methods 8.4. Method Declarations Meaning of Method Names Identity Conversion Widening Primitive Conversion Narrowing Primitive Conversion Generic Methods Method Result Method Throws Method Body Inheritance, Overriding, and Hiding static Fields final Fields transient Fields volatile Fields Field Initialization Restrictions on Field References in Initializers Simple Expression Names Qualified Expression Names 5.1. Kinds of Conversion 1/ Field Modifiers Simple Type Names Qualified Type Names Meaning of Expression Names 5. Conversions and Contexts 3.1. Unicode 3.2. Lexical Translations 3.3. Unicode Escapes 3.4. Line Terminators 3.5. Input Elements and Tokens 8.2. Class Members 8.3. Field Declarations Simple PackageOrTypeNames Qualified PackageOrTypeNames Meaning of Type Names Variables of Primitive Type Variables of Reference Type Kinds of Variables final Variables Initial Values of Variables Types, Classes, and Interfaces abstract Classes final Classes strictfp Classes Generic Classes and Type Parameters Inner Classes and Enclosing Instances Superclasses and Subclasses Superinterfaces Class Body and Member Declarations Simple Package Names Qualified Package Names Meaning of PackageOrTypeNames Where Types Are Used Variables 2.1. Context Free Grammars 2.2. The Lexical Grammar 2.3. The Syntactic Grammar 2.4. Grammar Notation Class Modifiers Syntactic Classification of a Name According to Context Reclassification of Contextually Ambiguous Names Meaning of Module Names and Package Names Subtyping among Primitive Types Subtyping among Class and Interface Types Subtyping among Array Types Least Upper Bound 1.1. Organization of the Specification 1.2. Example Programs 1.3. Notation 1.4. Relationship to Predefined Classes and Interfaces 1.5. Feedback 1.6. References 8.1. Class Declarations 6.5. Determining the Meaning of a Name Type Arguments of Parameterized Types Members and Constructors of Parameterized Types 2. Grammars Dependences Exported and Opened Packages Service Consumption Service Provision Unnamed Modules Observability of a Module 8. Classes Shadowing Obscuring 4.6. Type Erasure 4.7. Reifiable Types 4.8. Raw Types 4.9. Intersection Types Subtyping 1. Introduction Single Type Import Declarations Type Import on Demand Declarations Single Static Import Declarations Static Import on Demand Declarations 7.6. Top Level Type Declarations 7.7. Module Declarations 6.1. Declarations 6.2. Names and Identifiers 6.3. Scope of a Declaration 6.4. Shadowing and Obscuring 4.4. Type Variables 4.5. Parameterized Types Table of Contents 7.5. Import Declarations 6. Names Objects The Class Object The Class String When Reference Types Are the Same Legal Notice Named Packages Unnamed Packages Package Observability and Visibility Unary Numeric Promotion Binary Numeric Promotion 4.3. Reference Types and Values Gilad Bracha Alex Buckley 7.1. Package Members 7.2. Host Support for Modules and Packages 7.3. Compilation Units 7.4. Package Declarations 5.2. Assignment Contexts 5.3. Invocation Contexts 5.4. String Contexts 5.5. Casting Contexts 5.6. Numeric Contexts 4.1. The Kinds of Types and Values 4.2. Primitive Types and Values James Gosling The Java Language Specification 6.7. Fully Qualified Names and Canonical Names 7. Packages and Modules Boxing Conversion Unboxing Conversion Unchecked Conversion Capture Conversion String Conversion Forbidden Conversions Value Set Conversion 4. Types, Values, and Variables Java SE 9 Edition Allowed Narrowing Reference Conversion Checked and Unchecked Narrowing Reference Conversions Narrowing Reference Conversions at Run Time Integer Literals Floating Point Literals Boolean Literals Character Literals String Literals Escape Sequences for Character and String Literals The Null Literal The Java Language Specification The Java Language Specification Widening and Narrowing Primitive Conversion Widening Reference Conversion Narrowing Reference Conversion 3.6. White Space 3.7. Comments 3.8. Identifiers 3.9. Keywords Literals Java SE > Java SE Specifications > Java Language Specification Next Chapter 1. Introduction Legal Notice 14/ /15 5

6 Context-Free Grammars (CFGs) From the Java Language Standard, Sec. 2.1: A context-free grammar consists of a number of productions. Each production has an abstract symbol called a nonterminal as its left-hand side, and a sequence of one or more nonterminal and terminal symbols as its right-hand side. For each grammar, the terminal symbols are drawn from a specified alphabet. Starting from a sentence consisting of a single distinguished nonterminal, called the goal symbol, a given context-free grammar specifies a language, namely, the set of possible sequences of terminal symbols that can result from repeatedly replacing any nonterminal in the sequence with a right-hand side of a production for which the nonterminal is the left-hand side. 6

7 Context-Free Grammars (CFGs) Formally: CFG defined by 4-tuple G = (V, Σ, R, S) V is a set of nonterminal characters or variables Σ, the alphabet, is finite set of terminals. R, the set of (rewrite) rules or productions, is relation from V to (V Σ)* S V is the start variable (or start/goal symbol) Note: * is the Kleene Star. For any set X, X* denotes 0 or more instances of elements of X. Example: { 0, 1 }* = { ε, 0, 1, 00, 01, 10, 11, 000,... }, where ε denotes the empty string 7

8 Language of CFG For any strings u, v (V Σ)*, u directly yields v (written u v) if (α, β) R with α V and u 1, u 2 (V Σ)* and u = u 1 αu 2 and v = u 1 βu 2. Thus, v is a result of applying the rule (α, β) to u. Language of grammar G = (V, Σ, R, S) is the set L(G) = {w Σ* : S * w} where * is reflexive transitive closure of 8

9 Example: Well-Formed Parentheses G = (V, Σ, R, S) with Variables V = { S } Alphabet Σ = { (, ) } Productions R = { S SS, S (S), S () } May also write R as S SS (S) () 9

10 S SS (S) () The string (()()) is valid, i.e., in L(G). Proof: consider the derivation S (S) (SS) (()S) (()()) However, the string )( is not in L(G), since there is no derivation from S to )( 10

11 Trees in CS Our trees grow downwards! R: Root I: Internal node L: Leaf Typically, root is an internal node (when not?) R / \ L I L / \ I I / \ / \ L L L L 11

12 Parse Trees May use parse trees as compact representation for derivation. Internal nodes are variables, Leafs are terminals. S (S) (SS) (()S) (()()) is a derivation that follows from parse tree on right. S / \ ( S ) / \ S S / \ / \ ( ) ( ) Recall: S SS (S) () 12

13 Example: Parenthesized Sums a + b, u, x + (y + z),... G = (V, Σ, R, S) with Variables V = { S, P, X } Alphabet Σ = { (, ), +, a,..., z } Productions: S S + P P P ( S ) X X a... z 13

14 S S + P P P ( S ) X X a... z Parse tree for a + (b + c) + d: Parsing done bottom-up; lower position in parse tree is parsed/evaluated earlier Parentheses evaluated first + is evaluated left-to-right (left-associative) 3 2 S / \ S + P / \ S + P X / \ P ( S ) d / \ X S + P 1 a P X X b c 14

15 Note on Notation Formally, set of productions is a relation Can write this in different ways: Set notation: R = { (S, SS), (S, (S)), (S, ()) } Verbose arrow notation: S SS, S (S), S () Compact arrow notation: S SS (S) () Multiline notation: S: SS (S) () 15

16 Context-Free Languages L is a context-free language (CFL), if there exists a CFG G, such that L = L(G) Example: Is L 2 = { a n b n : n N } context-free? Yes, L 2 = L( ( { S }, { a, b }, { (S, asb), (S, ε) }, S ) ) Example: Is L 3 = { a n b n c n : n N } context-free? No, there is no CFG G with L 3 = L(G). Proof: see 16

17 So, is Java context free? No. CFGs don't address, e.g., variable declarations/bindings. But CFGs make the syntax precise, which is important both for programmers and parsers. 17

18 Backus-Naur Form (BNF) BNF is another notation for CFGs Close to compact arrow notation Use "::=" instead of arrow, "<...>" for variables Well-formed parentheses example in BNF: <S> ::= <S><S> (<S>) () 18

19 Extended Backus-Naur Form (EBNF) Typically puts terminals into quotes (" or ') Typically no "<...>" for variables [X] denotes 0 or 1 occurrences of X S ::= a [b] c abbreviates S ::= a c a b c {X} denotes 0 or more occurrences of X S ::= a {b} c abbreviates S ::= a T c, T ::= b T ε (X) defines a group S ::= a (b c) d abbreviates S ::= a b d a c d 19

20 Java Lexical Grammar Is a CFG Terminals are from Unicode character set Translate into input symbols that, with whitespace and comments discarded, form terminal symbols (tokens) for Java Syntactic Grammar Notation is variant of EBNF See also 20

21 Example: Java Decimal Numerals Want to prohibit leading 0 (except in 0 itself), to avoid clash with octal numeral Therefore, must be 0 or begin with non-zero Allow underscores, but not at beginning or end 21

22 DecimalNumeral: 0 NonZeroDigit [Digits] NonZeroDigit Underscores Digits NonZeroDigit: (one of) Digits: Digit Digit [DigitsAndUnderscores] Digit Digit: 0 NonZeroDigit DigitOrUnderscore: Digit _ Underscores: _ {_} DigitsAndUnderscores: DigitOrUnderscore {DigitOrUnderscore} 22

23 Expressions in Java The heart of the Add2Integers program from Chapter 2 is the line int total = n1 + n2; that performs the actual addition. The n1 + n2 that appears to the right of the equal sign is an example of an expression, which specifies the operations involved in the computation. An expression in Java consists of terms joined together by operators. Each term must be one of the following: A constant (such as or "hello, world") A variable name (such as n1, n2, or total) A method call that returns a value (such as readint) An expression enclosed in parentheses 23

24 Expressions int total = n1 + n2; Expression: consists of terms (n1,n2), or operands, joined by operators (+) Term: Literal, a.k.a. (unnamed) constant (3.14) Variable (n1), including named constants (PI, as in static final PI = 3.14) Method call (Math.abs(n1)) Expression enclosed in parentheses 24

25 Primitive Data Types Although complex data values are represented using objects, Java defines a set of primitive types to represent simple data. Of the eight primitive types available in Java, the programs in this text use only the following four: int This type is used to represent integers, which are whole numbers such as 17 or 53. double boolean char This type is used to represent numbers that include a decimal fraction, such as In Java, such values are called floating-point numbers; the name double comes from the fact that the representation uses twice the minimum precision. This type represents a logical value (true or false). This type represents a single character and is described in Chapter 8. 25

26 Primitive Types Data type: set of values (domain) + set of operators Type byte short int long float double char boolean Domain 8-bit integers in the range 128 to bit integers in the range to bit integers in the range to bit integers in the range to bit floating-point numbers in the range ±1.4 x to ± x bit floating-point numbers in the range ±4.39 x to ± x bit characters encoded using Unicode the values true and false Common operators The arithmetic operators: + add * multiply - subtract / divide % remainder The relational operators: == equal to!= not equal < less than <= > greater than >= less or equal greater or equal The arithmetic operators except % The relational operators The relational operators and +, -,... The logical operators: && and or! not The relational operators: == equal to!= not equal 26

27 Numbers This is covered further in Ch. 7 Decimal, binary, octal, hexadecimal notation In Java: = = 52 8 = 2A 16 K, M, G, T Decimal: 10 3, 10 6, 10 9, Binary: 2 10, 2 20, 2 30, 2 40 Prefix "0"/"0x" means octal/hex literal , 0x

28 The Structure of Memory The fundamental unit of memory inside a computer is called a bit, which is a contraction of the words binary digit. A bit can be in either of two states, usually denoted as 0 and 1. The hardware structure of a computer combines individual bits into larger units. In most modern architectures, the smallest unit on which the hardware operates is a sequence of eight consecutive bits called a byte. The following diagram shows a byte containing a combination of 0s and 1s: Numbers are stored in still larger units that consist of multiple bytes. The unit that represents the most common integer size on a particular hardware is called a word. Because machines have different architectures, the number of bytes in a word may vary from machine to machine.

29 Binary Notation Bytes and words can be used to represent integers of different sizes by interpreting the bits as a number in binary notation. Binary notation is similar to decimal notation but uses a different base. Decimal numbers use 10 as their base, which means that each digit counts for ten times as much as the digit to its right. Binary notation uses base 2, which means that each position counts for twice as much, as follows: The next The digit next The gives digit rightmost gives digit And so on... the number the number of is 4s. the of units 2s. place. 0 x 1 = 0 1 x 2 = 2 0 x 4 = 0 1 x 8 = 8 0 x 16 = 0 1 x 32 = 32 0 x 64 = 0 0 x 128 = 0 42

30 Numbers and Bases The calculation at the end of the preceding slide makes it clear that the binary representation is equivalent to the number 42. When it is important to distinguish the base, the text uses a small subscript, like this: = Although it is useful to be able to convert a number from one base to another, it is important to remember that the number remains the same. What changes is how you write it down. The number 42 is what you get if you count how many stars are in the pattern at the right. The number is the same whether you write it in English as forty-two, in decimal as 42, or in binary as Numbers do not have bases; representations do.

31 Octal and Hexadecimal Notation Because binary notation tends to get rather long, computer scientists often prefer octal (base 8) or hexadecimal (base 16) notation instead. Octal notation uses eight digits: 0 to 7. Hexadecimal notation uses sixteen digits: 0 to 9, followed by the letters A through F to indicate the values 10 to 15. The following diagrams show how the number forty-two appears in both octal and hexadecimal notation: octal x 1 = 2 5 x 8 = hexadecimal 2 A 10 x 1 = x 16 = The advantage of using either octal or hexadecimal notation is that doing so makes it easy to translate the number back to individual bits because you can convert each digit separately.

32 Exercises: Number Bases What is the decimal value for each of the following numbers? AD x 1 = 1 7 x 1 = 7 13 x 1 = 13 0 x 2 = 0 7 x 8 = x 16 = x 4 = 0 1 x 64 = x 8 = x 16 = As part of a code to identify the file type, every Java class file begins with the following sixteen bits: How would you express that number in hexadecimal notation? A F E CAFE 16 A D

33 Aside: Encoding Integers Computers represent integers in w bits x i { 0, 1 } X = x w-1 x w-2... x 1 x 0 For unsigned int's, X encodes value B2U(X) = w 1 x i 2 i i=0 For signed int's, X encodes This is two's complement encoding B2T(X) = x w 1 2 w 1 + w 2 x i 2 i i=0 Sign bit In Java: w = 8 (byte), 16 (short/char), 32 (int), or 64 (long) In Java, all integral types are signed, except for char See also 33

34 Bit-Wise Operators byte x = 42; // x encoded as byte y = 15; // y encoded as byte z = -16; // z encoded as Bit-wise operators refer to binary encodings AND: x & y = 10 // OR: x y = 47 // Shift left: y << 2 = 60 // Arithmetic shift right: y >> 2 = 3 // z >> 2 = -4 // Logical shift right: y >>> 2 = 3 // z >>> 2 = 60 // More on bit-wise operators in Lecture 7 34

35 Abstract Data Types (ADTs) ADT = set of values + set of operations + specification Specification may be informal prose and/or mathematical equations that must hold (e.g., commutative/distributive/associative laws) ADT abstracts from implementation 35

36 ADTs in Java In Java, typically implement ADT as class See also Michael S. Jenkins, Abstract Data Types in Java, Computing Mcgraw-Hill, /Abstract_Data_Types_in_Java.pdf 36

37 Constants and Variables The simplest terms that appear in expressions are constants and variables. The value of a constant does not change during the course of a program. A variable is a placeholder for a value that can be updated as the program runs. The format of a constant depends on its type: Integral constants consist of a string of digits, optionally preceded by a minus sign, as in 0, 42, -1, or Floating-point constants include a decimal point, as in or Floating-point constants can also be expressed in scientific notation by adding the letter E and an exponent after the digits of the number, so that 5.646E-8 represents the number x The two constants of type boolean are true and false. Character and string constants are discussed in detail in Chapter 8. For the moment, all you need to know is that a string constant consists of a sequence of characters enclosed in double quotation marks, such as "hello, world". 37

38 Constants and Variables The simplest terms that appear in expressions are constants and variables. The value of a constant does not change during the course of a program. A variable is a placeholder for a value that can be updated as the program runs. A variable in Java is most easily envisioned as a box capable of storing a value. total 42 Each variable has the following attributes: (contains an int) A name, which enables you to differentiate one variable from another. A type, which specifies what type of value the variable can contain. A value, which represents the current contents of the variable. The name and type of a variable are fixed. The value changes whenever you assign a new value to the variable. 38

39 Identifiers Identifier: name of variable, class, method etc. Must begin with letter or underscore Remaining characters must be letters, digits, or underscores Must not be one of Java's reserved words: abstract continue for new switch assert default goto package synchronized boolean do if private this break double implements protected throw byte else import public throws case enum instanceof return transient catch extends int short try char final interface static void class finally long strictfp volatile const float native super while 39

40 Coding Advice Naming Conventions Classes: UpperCamelCaseNouns Methods: lowercamelcaseverbs Constants: UPPER_CASE Variables: lowercamelcase Avoid single-character variable names, except for "temporary" ones: integers: i, j, k... char's: c, d, e... Try to use English names: e.g., use counter instead of zaehler See also

41 Variable Declarations In Java, you must declare a variable before you can use it. The declaration establishes the name and type of the variable and, in most cases, specifies the initial value as well. The most common form of a variable declaration is type name = value; where type is the name of a Java primitive type or class, name is an identifier that indicates the name of the variable, and value is an expression specifying the initial value. Most declarations appear as statements in the body of a method definition. Variables declared in this way are called local variables and are accessible only inside that method. Variables may also be declared as part of a class. These are called instance variables and are covered in Chapter 6. 41

42 Operators and Operands As in most languages, Java programs specify computation in the form of arithmetic expressions that closely resemble expressions in mathematics. The most common operators in Java are the ones that specify arithmetic computation: + Addition Subtraction * Multiplication / Division % Remainder Operators in Java usually appear between two subexpressions, which are called its operands. Operators that take two operands are called binary operators. The - operator can also appear as a unary operator, as in the expression -x, which denotes the negative of x. 42

43 Division and Type Casts Whenever you apply a binary operator to numeric values in Java, the result will be of type int if both operands are of type int, but will be a double if either operand is a double. This rule has important consequences in the case of division. For example, the expression 14 / 5 seems as if it should have the value 2.8, but because both operands are of type int, Java computes an integer result by throwing away the fractional part. The result is therefore 2. If you want to obtain the mathematically correct result, you need to convert at least one operand to a double, as in (double) 14 / 5 The conversion is accomplished by means of a type cast, which consists of a type name in parentheses. 43

44 Variable Variations Local variable: declared within method Instance variable (or non-static field): declared as part of a class (without static), one per object Class variables (or static field): declared as part of class (with static), only one for class 44

45 Scoping Scope: part of program where variable is visible Scope of local variables: from declaration until end of enclosing block (sequence of statements enclosed in braces, see Lec. 4) Shadowing (or hiding): multiple variables of same name have overlapping scope. In Java: local variables shadow fields (useful e.g. for setters, see later) no shadowing of local variables (local variable names must be unique within method, unlike e.g. for functions in C) 45

46 Operators and Operands Binary operators take two operands +, -, /, *, ==, <, >, &&,, &,, ^, <<, >>,... Unary operators take one operand +, -, ++, --,! Ternary operator takes three operands? : 46

47 Type Casts int op int int op double double op double int double double double c = 100; double f = 9 / 5 * c + 32; Casting: (type) expression double f = (double) 9 / 5 * c + 32; 47

48 The Pitfalls of Integer Division Consider the following Java statements, which are intended to convert 100 Celsius temperature to its Fahrenheit equivalent: double c = 100; double f = 9 / 5 * c + 32; The computation consists of evaluating the following expression: The problem arises from the fact that both 9 and 5 are of type int, which means that the result is also an int. 9 / 5 * c / 5 * c

49 The Pitfalls of Integer Division You can fix this problem by converting the fraction to a double, either by inserting decimal points or by using a type cast: double c = 100; double f = (double) 9 / 5 * c + 32; The computation now looks like this: (double) 9 / 5 * c

50 The Remainder Operator The only arithmetic operator that has no direct mathematical counterpart is %, which applies only to integer operands and computes the remainder when the first divided by the second: 14 % 5 returns 4 14 % 7 returns 0 7 % 14 returns 7 The result of the % operator make intuitive sense only if both operands are positive. The examples in this book do not depend on knowing how % works with negative numbers. The remainder operator turns out to be useful in a surprising number of programming applications and is well worth a bit of study. 50

51 Precedence If an expression contains more than one operator, Java uses precedence rules to determine the order of evaluation. The arithmetic operators have the following relative precedence: unary - (type cast) * / % + - highest lowest Thus, Java evaluates unary - operators and type casts first, then the operators *, /, and %, and then the operators + and -. Precedence applies only when two operands compete for the same operator. If the operators are independent, Java evaluates expressions from left to right. Parentheses may be used to change the order of operations. 51

52 Aside: Expression Evaluation Different operators may be ordered by precedence: An operand between operators of different precedence is bound to operator of higher precedence * has higher precedence than * 4 == 2 + (3 * 4)!= (2 + 3) * 4 3 bound to *, not to + Operators of same precedence level ordered by associativity: + is left-associative, operands between +'s bound to left E E100 == (1 + 1E100) + -1E100!= 1 + (1E E100) false + true + "" == (false + true) + ""!= false + (true + "") 1E100/true bound to left +, not to right + See also 52

53 [ 53

54 [ 54

55 Aside: Expression Evaluation Precendence and associativity... govern which operands belong to which operator imply paren's can be overridden by paren's Precedence, associativity and paren's tell us how to construct a fully parenthesized expression, which makes all bindings of operands to operators explicit: * (4 + 5) == 2 + (3 * (4 + 5)) Once expression is fully parenthesized, don't need to consider precedence and associativity any more. 55

56 Aside: Expression Evaluation To perform an operation, we first evaluate operands, then apply operator to results. (Special case: short-circuit evaluation for &&, see later) Do this recursively: if evaluating an operand entails performing an operation, the same rule applies again. Operands of operator ordered by evaluation direction: Java evaluates left-to-right (undefined in C or C++!) This matters when operand evaluation has side effects (such as assigning new values to variables) With i initially 0: i + 2 * ++i == 2 Wait a minute... * has higher precedence than +, but operands of * are evaluated after left operand of +? Explanation: evaluation direction, see next slide 56

57 Aside: Expression Evaluation What happens exactly: Fully parenthesized expression: i + (2 * (++i)) We thus have a sum with 2 operands. To compute sum, we first evaluate the left operand, then evaluate the right operand, then compute the sum of both. 1. Evaluating left operand i yields 0 + (2 * (++i)) 2. Right operand 2 * (++i) is a product, with again 2 operands thus recursively apply left-to-right rule: 1. Left operand 2 of product is already evaluated: 0 + (2 * (++i)) 2. Evaluating right operand ++i of product sets i to 1 (pre-increment), and yields 0 + (2 * 1) 3. Computing product yields Computing sum yields 2 57

58 Exercise: Precedence Evaluation (( ( ) % 3 ) * 4 ) + ( ( 5 * 6 ) / 7 )* ( 8 % 9 )) + 10 To get started: we have a sum (root of parse tree), whose left operand is another sum, whose left operand is a product, whose left operand is a modulo operation, whose left operand is the sum "1 + 2". 58

59 Coding Advice Naming, Paren's Use meaningful variable names Don't use "magic numbers", use named constants instead Add paren's if precedence may not be obvious Example: Replace help me == read && that!= thing by help ((me == read) && (that!= thing)) 59

60 Assignments variable = expression; Shorthand assignment: variable op= expression; variable++; Post-increment --variable; Pre-decrement 60

61 Assignment Statements You can change the value of a variable in your program by using an assignment statement, which has the general form: variable = expression; The effect of an assignment statement is to compute the value of the expression on the right side of the equal sign and assign that value to the variable that appears on the left. Thus, the assignment statement total = total + value; adds together the current values of the variables total and value and then stores that sum back in the variable total. When you assign a new value to a variable, the old value of that variable is lost. 61

62 Shorthand Assignments Statements such as total = total + value; are so common that Java allows the following shorthand form: total += value; The general form of a shorthand assignment is variable op= expression; where op is any of Java s binary operators. The effect of this statement is the same as variable = variable op (expression); For example, the following statement multiplies salary by 2. salary *= 2; 62

63 Increment and Decrement Operators Another important shorthand form that appears frequently in Java programs is the increment operator, which is most commonly written immediately after a variable, like this: x++; The effect of this statement is to add one to the value of x, which means that this statement is equivalent to x += 1; or in an even longer form x = x + 1; The -- operator (which is called the decrement operator) is similar but subtracts one instead of adding one. The ++ and -- operators are more complicated than shown here, but it makes sense to defer the details until Chapter

64 Booleans Boolean values: true, false Logical operators on Booleans: && These short-circuit: right operand evaluated only when needed Other logical operators on Booleans: ==!=! & ^ These don't short-circuit George Boole ( ) Relational operators producing Booleans: < <= == >= >!= 64

65 Boolean Expressions George Boole ( ) In many ways, the most important primitive type in Java is boolean, even though it is by far the simplest. The only values in the boolean domain are true and false, but these are exactly the values you need if you want your program to make decisions. The name boolean comes from the English mathematician George Boole who in 1854 wrote a book entitled An Investigation into the Laws of Thought, on Which are Founded the Mathematical Theories of Logic and Probabilities. That book introduced a system of logic that has come to be known as Boolean algebra, which is the foundation for the boolean data type. 65

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

Programming Lecture 3

Programming Lecture 3 Five-Minute Review 1. What is a variable? 2. What is a class? An object? 3. What is a package? 4. What is a method? A constructor? 5. What is an object variable? 1 Programming Lecture 3 Expressions etc.

More information

Programming Lecture 3

Programming Lecture 3 Five-Minute Review 1. What is a variable? 2. What is a class? An object? 3. What is a package? 4. What is a method? A constructor? 5. What is an object variable? 1 Programming Lecture 3 Expressions etc.

More information

Contents. Figures. Tables. Examples. Foreword. Preface. 1 Basics of Java Programming 1. xix. xxi. xxiii. xxvii. xxix

Contents. Figures. Tables. Examples. Foreword. Preface. 1 Basics of Java Programming 1. xix. xxi. xxiii. xxvii. xxix PGJC4_JSE8_OCA.book Page ix Monday, June 20, 2016 2:31 PM Contents Figures Tables Examples Foreword Preface xix xxi xxiii xxvii xxix 1 Basics of Java Programming 1 1.1 Introduction 2 1.2 Classes 2 Declaring

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

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

AP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS

AP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS AP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS PAUL L. BAILEY Abstract. This documents amalgamates various descriptions found on the internet, mostly from Oracle or Wikipedia. Very little of this

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

Operators and Expressions

Operators and Expressions Operators and Expressions Conversions. Widening and Narrowing Primitive Conversions Widening and Narrowing Reference Conversions Conversions up the type hierarchy are called widening reference conversions

More information

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

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

1 Lexical Considerations

1 Lexical Considerations Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science 6.035, Spring 2013 Handout Decaf Language Thursday, Feb 7 The project for the course is to write a compiler

More information

Lexical Considerations

Lexical Considerations Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science 6.035, Fall 2005 Handout 6 Decaf Language Wednesday, September 7 The project for the course is to write a

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

Index COPYRIGHTED MATERIAL

Index COPYRIGHTED MATERIAL Index COPYRIGHTED MATERIAL Note to the Reader: Throughout this index boldfaced page numbers indicate primary discussions of a topic. Italicized page numbers indicate illustrations. A abstract classes

More information

Lexical Considerations

Lexical Considerations Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science 6.035, Spring 2010 Handout Decaf Language Tuesday, Feb 2 The project for the course is to write a compiler

More information

Introduction to Programming Using Java (98-388)

Introduction to Programming Using Java (98-388) Introduction to Programming Using Java (98-388) Understand Java fundamentals Describe the use of main in a Java application Signature of main, why it is static; how to consume an instance of your own class;

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

1 Shyam sir JAVA Notes

1 Shyam sir JAVA Notes 1 Shyam sir JAVA Notes 1. What is the most important feature of Java? Java is a platform independent language. 2. What do you mean by platform independence? Platform independence means that we can write

More information

Decaf Language Reference Manual

Decaf Language Reference Manual Decaf Language Reference Manual C. R. Ramakrishnan Department of Computer Science SUNY at Stony Brook Stony Brook, NY 11794-4400 cram@cs.stonybrook.edu February 12, 2012 Decaf is a small object oriented

More information

IC Language Specification

IC Language Specification CS 301 Spring 2016 IC Language Specification The IC Language For the implementation project, you will build a compiler for an object-oriented language called IC (for Irish Coffee 1 ), which is essentially

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

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

Language Reference Manual simplicity

Language Reference Manual simplicity Language Reference Manual simplicity Course: COMS S4115 Professor: Dr. Stephen Edwards TA: Graham Gobieski Date: July 20, 2016 Group members Rui Gu rg2970 Adam Hadar anh2130 Zachary Moffitt znm2104 Suzanna

More information

The MaSH Programming Language At the Statements Level

The MaSH Programming Language At the Statements Level The MaSH Programming Language At the Statements Level Andrew Rock School of Information and Communication Technology Griffith University Nathan, Queensland, 4111, Australia a.rock@griffith.edu.au June

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

Java Fundamentals p. 1 The Origins of Java p. 2 How Java Relates to C and C++ p. 3 How Java Relates to C# p. 4 Java's Contribution to the Internet p.

Java Fundamentals p. 1 The Origins of Java p. 2 How Java Relates to C and C++ p. 3 How Java Relates to C# p. 4 Java's Contribution to the Internet p. Preface p. xix Java Fundamentals p. 1 The Origins of Java p. 2 How Java Relates to C and C++ p. 3 How Java Relates to C# p. 4 Java's Contribution to the Internet p. 5 Java Applets and Applications p. 5

More information

IPCoreL. Phillip Duane Douglas, Jr. 11/3/2010

IPCoreL. Phillip Duane Douglas, Jr. 11/3/2010 IPCoreL Programming Language Reference Manual Phillip Duane Douglas, Jr. 11/3/2010 The IPCoreL Programming Language Reference Manual provides concise information about the grammar, syntax, semantics, and

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

Expressions and Data Types CSC 121 Spring 2017 Howard Rosenthal

Expressions and Data Types CSC 121 Spring 2017 Howard Rosenthal Expressions and Data Types CSC 121 Spring 2017 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

This book is licensed under a Creative Commons Attribution 3.0 License

This book is licensed under a Creative Commons Attribution 3.0 License 6. Syntax Learning objectives: syntax and semantics syntax diagrams and EBNF describe context-free grammars terminal and nonterminal symbols productions definition of EBNF by itself parse tree grammars

More information

The PCAT Programming Language Reference Manual

The PCAT Programming Language Reference Manual The PCAT Programming Language Reference Manual Andrew Tolmach and Jingke Li Dept. of Computer Science Portland State University September 27, 1995 (revised October 15, 2002) 1 Introduction The PCAT language

More information

Chapter 2 Using Data. Instructor s Manual Table of Contents. At a Glance. Overview. Objectives. Teaching Tips. Quick Quizzes. Class Discussion Topics

Chapter 2 Using Data. Instructor s Manual Table of Contents. At a Glance. Overview. Objectives. Teaching Tips. Quick Quizzes. Class Discussion Topics Java Programming, Sixth Edition 2-1 Chapter 2 Using Data At a Glance Instructor s Manual Table of Contents Overview Objectives Teaching Tips Quick Quizzes Class Discussion Topics Additional Projects Additional

More information

Java Primer 1: Types, Classes and Operators

Java Primer 1: Types, Classes and Operators Java Primer 1 3/18/14 Presentation for use with the textbook Data Structures and Algorithms in Java, 6th edition, by M. T. Goodrich, R. Tamassia, and M. H. Goldwasser, Wiley, 2014 Java Primer 1: Types,

More information

Unit-II Programming and Problem Solving (BE1/4 CSE-2)

Unit-II Programming and Problem Solving (BE1/4 CSE-2) Unit-II Programming and Problem Solving (BE1/4 CSE-2) Problem Solving: Algorithm: It is a part of the plan for the computer program. An algorithm is an effective procedure for solving a problem in a finite

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

Full file at

Full file at Java Programming, Fifth Edition 2-1 Chapter 2 Using Data within a Program At a Glance Instructor s Manual Table of Contents Overview Objectives Teaching Tips Quick Quizzes Class Discussion Topics Additional

More information

C Language Part 1 Digital Computer Concept and Practice Copyright 2012 by Jaejin Lee

C Language Part 1 Digital Computer Concept and Practice Copyright 2012 by Jaejin Lee C Language Part 1 (Minor modifications by the instructor) References C for Python Programmers, by Carl Burch, 2011. http://www.toves.org/books/cpy/ The C Programming Language. 2nd ed., Kernighan, Brian,

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

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

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

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

A Short Summary of Javali

A Short Summary of Javali A Short Summary of Javali October 15, 2015 1 Introduction Javali is a simple language based on ideas found in languages like C++ or Java. Its purpose is to serve as the source language for a simple compiler

More information

The SPL Programming Language Reference Manual

The SPL Programming Language Reference Manual The SPL Programming Language Reference Manual Leonidas Fegaras University of Texas at Arlington Arlington, TX 76019 fegaras@cse.uta.edu February 27, 2018 1 Introduction The SPL language is a Small Programming

More information

Programming Languages Third Edition. Chapter 9 Control I Expressions and Statements

Programming Languages Third Edition. Chapter 9 Control I Expressions and Statements Programming Languages Third Edition Chapter 9 Control I Expressions and Statements Objectives Understand expressions Understand conditional statements and guards Understand loops and variation on WHILE

More information

Principles of Programming Languages COMP251: Syntax and Grammars

Principles of Programming Languages COMP251: Syntax and Grammars Principles of Programming Languages COMP251: Syntax and Grammars Prof. Dekai Wu Department of Computer Science and Engineering The Hong Kong University of Science and Technology Hong Kong, China Fall 2007

More information

CONTENTS. PART 1 Structured Programming 1. 1 Getting started 3. 2 Basic programming elements 17

CONTENTS. PART 1 Structured Programming 1. 1 Getting started 3. 2 Basic programming elements 17 List of Programs xxv List of Figures xxix List of Tables xxxiii Preface to second version xxxv PART 1 Structured Programming 1 1 Getting started 3 1.1 Programming 3 1.2 Editing source code 5 Source code

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

Java Programming. Atul Prakash

Java Programming. Atul Prakash Java Programming Atul Prakash Java Language Fundamentals The language syntax is similar to C/ C++ If you know C/C++, you will have no trouble understanding Java s syntax If you don't, it will be easier

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

Typescript on LLVM Language Reference Manual

Typescript on LLVM Language Reference Manual Typescript on LLVM Language Reference Manual Ratheet Pandya UNI: rp2707 COMS 4115 H01 (CVN) 1. Introduction 2. Lexical Conventions 2.1 Tokens 2.2 Comments 2.3 Identifiers 2.4 Reserved Keywords 2.5 String

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

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

Appendix. Grammar. A.1 Introduction. A.2 Keywords. There is no worse danger for a teacher than to teach words instead of things.

Appendix. Grammar. A.1 Introduction. A.2 Keywords. There is no worse danger for a teacher than to teach words instead of things. A Appendix Grammar There is no worse danger for a teacher than to teach words instead of things. Marc Block Introduction keywords lexical conventions programs expressions statements declarations declarators

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

The Sun s Java Certification and its Possible Role in the Joint Teaching Material

The Sun s Java Certification and its Possible Role in the Joint Teaching Material The Sun s Java Certification and its Possible Role in the Joint Teaching Material Nataša Ibrajter Faculty of Science Department of Mathematics and Informatics Novi Sad 1 Contents Kinds of Sun Certified

More information

Language Reference Manual

Language Reference Manual Programming Languages and Translators Language Reference Manual ART: Animation Rendering Tool Brett Jervey - baj2125 Gedion Metaferia - gym2103 Natan Kibret - nfk2105 Soul Joshi - srj2120 October 26, 2016

More information

FRAC: Language Reference Manual

FRAC: Language Reference Manual FRAC: Language Reference Manual Justin Chiang jc4127 Kunal Kamath kak2211 Calvin Li ctl2124 Anne Zhang az2350 1. Introduction FRAC is a domain-specific programming language that enables the programmer

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

Zhifu Pei CSCI5448 Spring 2011 Prof. Kenneth M. Anderson

Zhifu Pei CSCI5448 Spring 2011 Prof. Kenneth M. Anderson Zhifu Pei CSCI5448 Spring 2011 Prof. Kenneth M. Anderson Introduction History, Characteristics of Java language Java Language Basics Data types, Variables, Operators and Expressions Anatomy of a Java Program

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

CS260 Intro to Java & Android 03.Java Language Basics

CS260 Intro to Java & Android 03.Java Language Basics 03.Java Language Basics http://www.tutorialspoint.com/java/index.htm CS260 - Intro to Java & Android 1 What is the distinction between fields and variables? Java has the following kinds of variables: Instance

More information

Table of Contents Preface Bare Necessities... 17

Table of Contents Preface Bare Necessities... 17 Table of Contents Preface... 13 What this book is about?... 13 Who is this book for?... 14 What to read next?... 14 Personages... 14 Style conventions... 15 More information... 15 Bare Necessities... 17

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

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

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

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

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

Review of the C Programming Language for Principles of Operating Systems

Review of the C Programming Language for Principles of Operating Systems Review of the C Programming Language for Principles of Operating Systems Prof. James L. Frankel Harvard University Version of 7:26 PM 4-Sep-2018 Copyright 2018, 2016, 2015 James L. Frankel. All rights

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

Graphical Interface and Application (I3305) Semester: 1 Academic Year: 2017/2018 Dr Antoun Yaacoub

Graphical Interface and Application (I3305) Semester: 1 Academic Year: 2017/2018 Dr Antoun Yaacoub Lebanese University Faculty of Science Computer Science BS Degree Graphical Interface and Application (I3305) Semester: 1 Academic Year: 2017/2018 Dr Antoun Yaacoub 2 Crash Course in JAVA Classes A Java

More information

Maciej Sobieraj. Lecture 1

Maciej Sobieraj. Lecture 1 Maciej Sobieraj Lecture 1 Outline 1. Introduction to computer programming 2. Advanced flow control and data aggregates Your first program First we need to define our expectations for the program. They

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

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

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

Java enum, casts, and others (Select portions of Chapters 4 & 5)

Java enum, casts, and others (Select portions of Chapters 4 & 5) Enum or enumerates types Java enum, casts, and others (Select portions of Chapters 4 & 5) Sharma Chakravarthy Information Technology Laboratory (IT Lab) Computer Science and Engineering Department The

More information

LOON. Language Reference Manual THE LANGUAGE OF OBJECT NOTATION. Kyle Hughes, Jack Ricci, Chelci Houston-Borroughs, Niles Christensen, Habin Lee

LOON. Language Reference Manual THE LANGUAGE OF OBJECT NOTATION. Kyle Hughes, Jack Ricci, Chelci Houston-Borroughs, Niles Christensen, Habin Lee LOON THE LANGUAGE OF OBJECT NOTATION Language Reference Manual Kyle Hughes, Jack Ricci, Chelci Houston-Borroughs, Niles Christensen, Habin Lee October 2017 1 Contents 1 Introduction 3 2 Types 4 2.1 JSON............................................

More information

Points To Remember for SCJP

Points To Remember for SCJP Points To Remember for SCJP www.techfaq360.com The datatype in a switch statement must be convertible to int, i.e., only byte, short, char and int can be used in a switch statement, and the range of the

More information

A Simple Syntax-Directed Translator

A Simple Syntax-Directed Translator Chapter 2 A Simple Syntax-Directed Translator 1-1 Introduction The analysis phase of a compiler breaks up a source program into constituent pieces and produces an internal representation for it, called

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

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

LECTURE 3 C++ Basics Part 2

LECTURE 3 C++ Basics Part 2 LECTURE 3 C++ Basics Part 2 OVERVIEW Operators Type Conversions OPERATORS Operators are special built-in symbols that have functionality, and work on operands. Operators are actually functions that use

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

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

Sir Muhammad Naveed. Arslan Ahmed Shaad ( ) Muhammad Bilal ( ) Sir Muhammad Naveed Arslan Ahmed Shaad (1163135 ) Muhammad Bilal ( 1163122 ) www.techo786.wordpress.com CHAPTER: 2 NOTES:- VARIABLES AND OPERATORS The given Questions can also be attempted as Long Questions.

More information

Reserved Words and Identifiers

Reserved Words and Identifiers 1 Programming in C Reserved Words and Identifiers Reserved word Word that has a specific meaning in C Ex: int, return Identifier Word used to name and refer to a data element or object manipulated by the

More information

Decaf Language Reference

Decaf Language Reference Decaf Language Reference Mike Lam, James Madison University Fall 2016 1 Introduction Decaf is an imperative language similar to Java or C, but is greatly simplified compared to those languages. It will

More information

Java: framework overview and in-the-small features

Java: framework overview and in-the-small features Chair of Software Engineering Carlo A. Furia, Marco Piccioni, Bertrand Meyer Java: framework overview and in-the-small features Chair of Software Engineering Carlo A. Furia, Marco Piccioni, Bertrand Meyer

More information

Bits, Words, and Integers

Bits, Words, and Integers Computer Science 52 Bits, Words, and Integers Spring Semester, 2017 In this document, we look at how bits are organized into meaningful data. In particular, we will see the details of how integers are

More information

JAVASCRIPT AND JQUERY: AN INTRODUCTION (WEB PROGRAMMING, X452.1)

JAVASCRIPT AND JQUERY: AN INTRODUCTION (WEB PROGRAMMING, X452.1) Technology & Information Management Instructor: Michael Kremer, Ph.D. Class 2 Professional Program: Data Administration and Management JAVASCRIPT AND JQUERY: AN INTRODUCTION (WEB PROGRAMMING, X452.1) AGENDA

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

C++ Programming: From Problem Analysis to Program Design, Third Edition

C++ Programming: From Problem Analysis to Program Design, Third Edition C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 2: Basic Elements of C++ Objectives (continued) Become familiar with the use of increment and decrement operators Examine

More information

L-System Fractal Generator: Language Reference Manual

L-System Fractal Generator: Language Reference Manual L-System Fractal Generator: Language Reference Manual Michael Eng, Jervis Muindi, Timothy Sun Contents 1 Program Definition 3 2 Lexical Conventions 3 2.1 Comments...............................................

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

CS313D: ADVANCED PROGRAMMING LANGUAGE

CS313D: ADVANCED PROGRAMMING LANGUAGE CS313D: ADVANCED PROGRAMMING LANGUAGE Computer Science department Lecture 2 : C# Language Basics Lecture Contents 2 The C# language First program Variables and constants Input/output Expressions and casting

More information

Introduction. Assessment Test. Part I The Programmer s Exam 1

Introduction. Assessment Test. Part I The Programmer s Exam 1 4276FM.fm Page ix Thursday, October 2, 2003 11:22 AM at a Glance Introduction Assessment Test xix xxv Part I The Programmer s Exam 1 Chapter 1 Language Fundamentals 3 Chapter 2 Operators and Assignments

More information

Chapter 2 Using Data. Instructor s Manual Table of Contents. At a Glance. A Guide to this Instructor s Manual:

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

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

ARG! Language Reference Manual

ARG! Language Reference Manual ARG! Language Reference Manual Ryan Eagan, Mike Goldin, River Keefer, Shivangi Saxena 1. Introduction ARG is a language to be used to make programming a less frustrating experience. It is similar to C

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