Introduction to Programming (Java) 2/12
|
|
- Deborah Henderson
- 5 years ago
- Views:
Transcription
1 Introduction to Programming (Java) 2/12 Michal Krátký Department of Computer Science Technical University of Ostrava Introduction to Programming (Java) 2008/2009 c Michal Krátký Introduction to Programming (Java) 1/34
2 James Gosling, Sun Microsystems, The original name Oak, Java in The first version was released in 1996 (JDK 1.0). Features: object-oriented language strong typed language it includes garbage collector it supports parallel threads it supports exceptions safe programming language c Michal Krátký Introduction to Programming (Java) 2/34
3 JDK and IDEs JDK Java Platform, the current version NetBeans, IDE. Eclipse, IDE. quick compiler. c Michal Krátký Introduction to Programming (Java) 3/34
4 References Slides for this course: R. Szturc: Introduction to Programming (Java). Department of Computer Science, VŠB Technical University of Ostrava, 2004, B. Eckel: Thinking in Java. 2002, Sun MicroSystems: Sun Developer Network. 2007, A lot of books. c Michal Krátký Introduction to Programming (Java) 4/34
5 Compilation vs Interpretation of Source Code Compiler a source code is compiled in an executable file. Interpreter statements are executed in the runtime. Java utilizes a combination of both issues. Code (*.java file) is compiled to the byte-code (*.class file). The class files are interpreted by the java virtual machine (javavm). The virtual machine is represented by the java executable file. Libraries (jar archives) must be defined in the CLASSPATH variable (the variable of the OS). c Michal Krátký Introduction to Programming (Java) 5/34
6 Java Platform Platform hardware and software environment for a program runtime. Java platform a software platform over a hardware platform. Java API Java Virtual Machine Operation System Hardware Java Platform Java API a set of classes input/output, networking, databases and so on. c Michal Krátký Introduction to Programming (Java) 6/34
7 Example 1.1 public class Example0101 { public s t a t i c void main ( S t r i n g [ ] args ) { System. out. p r i n t l n ( " Hello World! \ n " ) ; } } c Michal Krátký Introduction to Programming (Java) 7/34
8 Compilation and Start-up of a Program Compilation: javac Example0101.java Start-up: java Example0101 The start-up with the redirection of the standard output into the file file.txt: java Example0101 > file.txt c Michal Krátký Introduction to Programming (Java) 8/34
9 Compiling and Running Program in an IDE We must create a project in an IDE (Integrated Development Environment). Source files are added into this project. One file is labeled as the main file. It means that the main() method of this file starts a program. c Michal Krátký Introduction to Programming (Java) 9/34
10 HelloWorld in NetBeans c Michal Krátký Introduction to Programming (Java) 10/34
11 Debugging Efficient Finding of Bugs 1/2 Debugging is the sole efficient tool for finding of bugs in a source code. We can utilize a command-line debugger or an IDE s debugger (NetBeans, Eclipse and so on). We add breakpoints on lines, run-time of a program is stopped on these lines. c Michal Krátký Introduction to Programming (Java) 11/34
12 Debugging Efficient Finding of Bugs 2/2 Functions: Step Into - a step into a method Step Over - a step on the next line without a step into a method Run - program is run until the next breakpoint is reached Step Out - a step out from the current method We can look: Stack Trace - a stack of called methods values of local and global variables c Michal Krátký Introduction to Programming (Java) 12/34
13 Syntax vs Semantics Syntax it defines constructs to be possible in the language. Which program is or is not correct. Semantics it defines the meaning of constructs. E.g., what is executed after a statement. Two types of errors: An error during a compilation it is reported by a compiler. A syntactic error e.g. missing ; A semantic error e.g. incompatible data type is assigned. An error in run-time it is reported by the virtual machine during the run-time. We catch these errors by exceptions. c Michal Krátký Introduction to Programming (Java) 13/34
14 A program consists of classes. Each class includes data (attributes) and methods. Methods consists of the header (name, parameters, and return type) and body with statements. Statements work with variables. Performance of statements includes the statement evaluation. Each variable, value or expression has a data type. The program is a sequence of lexical symbols at the lowest level. c Michal Krátký Introduction to Programming (Java) 14/34
15 Lexical Symbols White characters nad remarks: White space: space (SP), horizontal tab (HT), form feed (FF), newline (LF), carriage return (CR). Remarks: /* remark */ // remark Basic types of lexical symbols: identifiers: i j System9 number_of_elements keywords: while float int public class literals: 124 true d "hello" delimiters: ( ) { } [ ] ; :,. operators: + / && = = < >>= c Michal Krátký Introduction to Programming (Java) 15/34
16 Example 2.1 public class Example0201 { public s t a t i c void main ( S t r i n g [ ] args ) { i n t i = 5 ; i n t j = i + 3 ; System. out. p r i n t l n ( " i = " + i + ", j = " + j + " \ n " ) ; } } i n t d=0xff ; / / hexadecimal value i n t e =077; / / o c t a n t value System. out. p r i n t l n ( " d= " + d + ", e= " + e + " \ n " ) ; / / d=255, e=63 c Michal Krátký Introduction to Programming (Java) 16/34
17 Types, values, and variables Data is stored in variables. Each variable is specified by the name and data type (so called declaration). We distinguish two types of data types: Primitive data types. A variable of primitive data type contains the one value of the defined size: boolean b = true; // boolean type int i = 456; // integer double f = ; // real number References Address of an object (the instance of a class) or array in memory: Hashtable h = new Hashtable(); int[] a = new int[20]; c Michal Krátký Introduction to Programming (Java) 17/34
18 Integer Data Types 1/2 Type Range Size [b] byte short int long char c Michal Krátký Introduction to Programming (Java) 18/34
19 Integer Data Types 2/2 Operators: Comparison operators: <, <=, >, >=, ==,! = Unary plus and minus: +, Binary arithmetic operators: +,,, /, % Prefix and postfix operators for +1 and -1 operations, respectively: ++, Signed and unsigned bit shifts: <<, >>, >>> A bit complement: ~ Bit operators: & (AND), (OR), ^ (XOR) c Michal Krátký Introduction to Programming (Java) 19/34
20 Assignment Operator An expression: expr1 = expr2. An evaluation: Evaluation of the left side (expr1). Evaluation of the right side (expr2). The value of the right side is stored into the variable of the legth side. The value of the whole expression is the value of the right side. int b = c + 1; a[i++] = x + y; c Michal Krátký Introduction to Programming (Java) 20/34
21 Example 2.3 public class Example0203 { public s t a t i c void main ( S t r i n g [ ] args ) { i n t i = 5 ; i + + ; / / i = 6 i n t j = i + 3; / / i = 5, j = 9 j = i + 3 ; / / i = 4, j = 7 j + = 6 ; / / j = 1 3 boolean b = ( j = = 1 ) ; / / b = f a l s e ; System. out. p r i n t l n ( " i = " + i + ", j = " + j + ", b= " + b + " \ n " ) ; } } c Michal Krátký Introduction to Programming (Java) 21/34
22 Example 2.4 public class Example0204 { public s t a t i c void main ( S t r i n g [ ] args ) { i n t i = 1 ; / / i = 0001 i = i < < 1 ; / / i = 2 ( ) i n t j = 1 ; i n t k = i j ; / / k = 3 ( ) k = i & j ; / / k = 0 System. out. p r i n t l n ( " i = " + i + ", j = " + j + ", k= " + k + " \ n " ) ; } } c Michal Krátký Introduction to Programming (Java) 22/34
23 Example 2.5 1/2 public class Example0205 { public s t a t i c void main ( S t r i n g args [ ] ) { i n t a = ~ 0 ; / / a = 1, a = a = a < < 1 ; / / a = a = 1; i n t aa = a > > 1 ; / / aa = 1 i n t ab = a > > > 1; / / ab = / / ab = c Michal Krátký Introduction to Programming (Java) 23/34
24 Example 2.5 2/2 a = 3 < < 3 0 ; / / a = aa = a > > 1 ; / / aa = } } i n t b = 2 0, c = 3 ; i n t d = b / c ; / / d = 6 i n t e = b % c ; / / e = 2 ; c Michal Krátký Introduction to Programming (Java) 24/34
25 Real Data Types 1/2 Real number form: s m 2 exp. Type s m exp Size [b] float {-1,1} double {-1,1} Type Min Value Max Value float e-45f e+38f double e e+308 c Michal Krátký Introduction to Programming (Java) 25/34
26 Real Data Types 2/2 Operators: Comparison operators: <, <=, >, >=, ==,! = Unary plus and minus: +, Binary arithmetic operators: +,,, / Prefix and postfix operators for +1 and -1 operations, respectively: ++, c Michal Krátký Introduction to Programming (Java) 26/34
27 Example 2.6 public class Example0206 { public s t a t i c void main ( S t r i n g args [ ] ) { double f = 1. 0 ; f = f ; / / f = f = f / 5. 0 ; / / f = 4. 0 f ; / / f = 3. 0 } } c Michal Krátký Introduction to Programming (Java) 27/34
28 Bool Data Type Bool data type has two possible values: true and false. Operators: Comparison operators: ==,! = A logical complement:! Binary logical operators: &,, ˆ Conditional AND and OR operators: &&, Ternary conditional operator:?: Boolean expressions controls these constructs: if while do for c Michal Krátký Introduction to Programming (Java) 28/34
29 Example 2.7 1/2 public class Example0207 { public s t a t i c void main ( S t r i n g [ ] args ) { boolean f l a g = true ; f l a g =! f l a g ; / / f l a g = f a l s e boolean bvar = true ; boolean r1 = f l a g bvar ; / / r1 = t r u e boolean r2 = f l a g & bvar ; / / r2 = f a l s e i f ( r1 r2 ) / / t r u e or f a l s e = t r u e { System. out. p r i n t l n ( " r1 or r2 = t r u e " ) ; } c Michal Krátký Introduction to Programming (Java) 29/34
30 Example 2.7 2/2 double f V a l = r1? 1. 0 : 2. 0 ; / / f V a l = 1. 0 } } System. out. p r i n t l n ( " f l a g = " + f l a g + ", bvar= " + bvar + ", f V a l = " + f V a l + " \ n " ) ; c Michal Krátký Introduction to Programming (Java) 30/34
31 Compound Assignment Operators =, / =, % =, + =, =, <<=, >>=, & =, = ˆ = The meaning of the expr1 op= expr2 is the same as expr1 = expr1 op expr2. But then expr1 is evaluated only one times. x *= 6; x = x * 6; a[i++] += 3; is not equivalent with a[i++] = a[i++] + 3; c Michal Krátký Introduction to Programming (Java) 31/34
32 Casting Default casting: byte b ; i n t i ;... i = b ; b = i; is wrong. We must use the expression: (type)expr1, which transforms the type of the expression value at the type. b = (byte)i; c Michal Krátký Introduction to Programming (Java) 32/34
33 Priority of Operators from the highest priority 1. () 2. [], postfix ++ and 3. unary + and, ~,!, casting, prefix ++ and 4., /, % 5. +, 6. <<, >>, >>> 7. <, >, <=, >=, instanceof 8. ==,! = 9. & 10. ˆ && ? : 15. =, =, / =, % =, + =, =, <<=, >>=, >>>=, & =, ˆ =, = c Michal Krátký Introduction to Programming (Java) 33/34
34 Associativity of Operators The majority of the binary operators is associative from the left. Therefore: a + b + c has the same meaning as: (a + b) + c Some operators are associative form the right. a = b = c has the same meaning as: a = (b = c) c Michal Krátký Introduction to Programming (Java) 34/34
Programming. Syntax and Semantics
Programming For the next ten weeks you will learn basic programming principles There is much more to programming than knowing a programming language When programming you need to use a tool, in this case
More informationJava language. Part 1. Java fundamentals. Yevhen Berkunskyi, NUoS
Java language Part 1. Java fundamentals Yevhen Berkunskyi, NUoS eugeny.berkunsky@gmail.com http://www.berkut.mk.ua What Java is? Programming language Platform: Hardware Software OS: Windows, Linux, Solaris,
More informationThe 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 informationThe 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 informationTools : 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 informationIntroduction 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 informationOperators in java Operator operands.
Operators in java Operator in java is a symbol that is used to perform operations and the objects of operation are referred as operands. There are many types of operators in java such as unary operator,
More informationCSC 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 informationJava provides a rich set of operators to manipulate variables. We can divide all the Java operators into the following groups:
Basic Operators 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 informationCharacter 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 informationSir 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 informationIntroduction to Visual Basic and Visual C++ Introduction to Java. JDK Editions. Overview. Lesson 13. Overview
Introduction to Visual Basic and Visual C++ Introduction to Java Lesson 13 Overview I154-1-A A @ Peter Lo 2010 1 I154-1-A A @ Peter Lo 2010 2 Overview JDK Editions Before you can write and run the simple
More informationSECTION 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 information1 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 informationLanguage 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 informationJAVA 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 information6.096 Introduction to C++ January (IAP) 2009
MIT OpenCourseWare http://ocw.mit.edu 6.096 Introduction to C++ January (IAP) 2009 For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms. Welcome to 6.096 Lecture
More informationJava 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 informationJava 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 informationChapter 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 informationComputer 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 informationA flow chart is a graphical or symbolic representation of a process.
Q1. Define Algorithm with example? Answer:- A sequential solution of any program that written in human language, called algorithm. Algorithm is first step of the solution process, after the analysis of
More informationIntroduction to Java
Introduction to Java Module 1: Getting started, Java Basics 22/01/2010 Prepared by Chris Panayiotou for EPL 233 1 Lab Objectives o Objective: Learn how to write, compile and execute HelloWorld.java Learn
More informationLexical 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 informationAn overview of Java, Data types and variables
An overview of Java, Data types and variables Lecture 2 from (UNIT IV) Prepared by Mrs. K.M. Sanghavi 1 2 Hello World // HelloWorld.java: Hello World program import java.lang.*; class HelloWorld { public
More informationCourse information. Petr Hnětynka 2/2 Zk/Z
JAVA Introduction Course information Petr Hnětynka hnetynka@d3s.mff.cuni.cz http://d3s.mff.cuni.cz/~hnetynka/java/ 2/2 Zk/Z exam written test zápočet practical test in the lab max 5 attempts zápočtový
More informationExpressions and Data Types CSC 121 Spring 2015 Howard Rosenthal
Expressions and Data Types CSC 121 Spring 2015 Howard Rosenthal Lesson Goals Understand the basic constructs of a Java Program Understand how to use basic identifiers Understand simple Java data types
More informationPYTHON- AN INNOVATION
PYTHON- AN INNOVATION As per CBSE curriculum Class 11 Chapter- 2 By- Neha Tyagi PGT (CS) KV 5 Jaipur(II Shift) Jaipur Region Python Introduction In order to provide an input, process it and to receive
More informationLexical Structure (Chapter 3, JLS)
Lecture Notes CS 140 Winter 2006 Craig A. Rich Lexical Structure (Chapter 3, JLS) - A Java source code file is viewed as a string of unicode characters, including line separators. - A Java source code
More informationOperators. 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 informationExpressions and Data Types CSC 121 Fall 2015 Howard Rosenthal
Expressions and Data Types CSC 121 Fall 2015 Howard Rosenthal Lesson Goals Understand the basic constructs of a Java Program Understand how to use basic identifiers Understand simple Java data types and
More informationIntroduction. Following are the types of operators: Unary requires a single operand Binary requires two operands Ternary requires three operands
Introduction Operators are the symbols which operates on value or a variable. It tells the compiler to perform certain mathematical or logical manipulations. Can be of following categories: Unary requires
More informationLecture 1: Overview of Java
Lecture 1: Overview of Java What is java? Developed by Sun Microsystems (James Gosling) A general-purpose object-oriented language Based on C/C++ Designed for easy Web/Internet applications Widespread
More informationOperators 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 informationObject oriented programming. Instructor: Masoud Asghari Web page: Ch: 3
Object oriented programming Instructor: Masoud Asghari Web page: http://www.masses.ir/lectures/oops2017sut Ch: 3 1 In this slide We follow: https://docs.oracle.com/javase/tutorial/index.html Trail: Learning
More informationObjects 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 informationA 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 informationPace University. Fundamental Concepts of CS121 1
Pace University Fundamental Concepts of CS121 1 Dr. Lixin Tao http://csis.pace.edu/~lixin Computer Science Department Pace University October 12, 2005 This document complements my tutorial Introduction
More informationLexical 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 informationJava: 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 information3. 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 informationA 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 informationUNIT- 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 informationChapter 2: Data and Expressions
Chapter 2: Data and Expressions CS 121 Department of Computer Science College of Engineering Boise State University August 21, 2017 Chapter 2: Data and Expressions CS 121 1 / 51 Chapter 1 Terminology Review
More informationJava Fall 2018 Margaret Reid-Miller
Java 15-121 Fall 2018 Margaret Reid-Miller Reminders How many late days can you use all semester? 3 How many late days can you use for a single assignment? 1 What is the penalty for turning an assignment
More informationGetting 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 informationCourse information. Petr Hnětynka 2/2 Zk/Z
JAVA Introduction Course information Petr Hnětynka hnetynka@d3s.mff.cuni.cz http://d3s.mff.cuni.cz/~hnetynka/java/ 2/2 Zk/Z exam written test zápočet practical test in the lab zápočtový program "reasonable"
More informationCHAPTER 1. Introduction to JAVA Programming
CHAPTER 1 Introduction to JAVA Programming What java is Java is high level You can use java to write computer applications that computes number,process words,play games,store data, etc. History of Java.
More informationDeclaration 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 informationIntroduction to Programming (Java) 4/12
Introduction to Programming (Java) 4/12 Michal Krátký Department of Computer Science Technical University of Ostrava Introduction to Programming (Java) 2008/2009 c 2006 2008 Michal Krátký Introduction
More informationModule - 2 Overview of Java History of Java Technology?
Overview of Java Module - 2 Java is an object-oriented programming language with its own runtime environment. Java is a programming language and a platform. Java is a high level, robust, secured and object-oriented
More informationNOOTAN PADIA ASSIST. PROF. MEFGI, RAJKOT.
NOOTAN PADIA ASSIST. PROF. MEFGI, RAJKOT. Object and Classes Data Abstraction and Encapsulation Inheritance Polymorphism Dynamic Binding Message Communication Objects are the basic runtime entities in
More informationbitwise inclusive OR Logical logical AND && logical OR Ternary ternary? : Assignment assignment = += -= *= /= %= &= ^= = <<= >>= >>>=
Operators in java Operator in java is a symbol that is used to perform operations. For example: +, -, *, / etc. There are many types of operators in java which are given below: Unary Operator, Arithmetic
More informationLecture 3. More About C
Copyright 1996 David R. Hanson Computer Science 126, Fall 1996 3-1 Lecture 3. More About C Programming languages have their lingo Programming language Types are categories of values int, float, char Constants
More informationComputers Programming Course 6. Iulian Năstac
Computers Programming Course 6 Iulian Năstac Recap from previous course Data types four basic arithmetic type specifiers: char int float double void optional specifiers: signed, unsigned short long 2 Recap
More informationBasic operators, Arithmetic, Relational, Bitwise, Logical, Assignment, Conditional operators. JAVA Standard Edition
Basic operators, Arithmetic, Relational, Bitwise, Logical, Assignment, Conditional operators JAVA Standard Edition Java - Basic Operators Java provides a rich set of operators to manipulate variables.
More informationProgramming. Elementary Concepts
Programming Elementary Concepts Summary } C Language Basic Concepts } Comments, Preprocessor, Main } Key Definitions } Datatypes } Variables } Constants } Operators } Conditional expressions } Type conversions
More informationFall 2017 CISC124 9/16/2017
CISC124 Labs start this week in JEFF 155: Meet your TA. Check out the course web site, if you have not already done so. Watch lecture videos if you need to review anything we have already done. Problems
More informationProgramming Language Basics
Programming Language Basics Lecture Outline & Notes Overview 1. History & Background 2. Basic Program structure a. How an operating system runs a program i. Machine code ii. OS- specific commands to setup
More informationJava provides a rich set of operators to manipulate variables. We can divide all the Java operators into the following groups:
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 informationOperators and Expressions in C & C++ Mahesh Jangid Assistant Professor Manipal University, Jaipur
Operators and Expressions in C & C++ Mahesh Jangid Assistant Professor Manipal University, Jaipur Operators and Expressions 8/24/2012 Dept of CS&E 2 Arithmetic operators Relational operators Logical operators
More informationFull file at
Java Programming: From Problem Analysis to Program Design, 3 rd Edition 2-1 Chapter 2 Basic Elements of Java At a Glance Instructor s Manual Table of Contents Overview Objectives s Quick Quizzes Class
More informationExpressions & Flow Control
Objectives Distinguish between instance and local variables 4 Expressions & Flow Control Describe how instance variables are initialized Identify and correct a Possible reference before assignment compiler
More informationCourse Outline Introduction to C-Programming
ECE3411 Fall 2015 Lecture 1a. Course Outline Introduction to C-Programming Marten van Dijk, Syed Kamran Haider Department of Electrical & Computer Engineering University of Connecticut Email: {vandijk,
More informationCMPT 125: Lecture 3 Data and Expressions
CMPT 125: Lecture 3 Data and Expressions Tamara Smyth, tamaras@cs.sfu.ca School of Computing Science, Simon Fraser University January 3, 2009 1 Character Strings A character string is an object in Java,
More informationInformation Science 1
Information Science 1 Simple Calcula,ons Week 09 College of Information Science and Engineering Ritsumeikan University Topics covered l Terms and concepts from Week 8 l Simple calculations Documenting
More informationData Types and Variables in C language
Data Types and Variables in C language Disclaimer The slides are prepared from various sources. The purpose of the slides is for academic use only Operators in C C supports a rich set of operators. Operators
More informationC 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 informationCS11 Java. Fall Lecture 1
CS11 Java Fall 2006-2007 Lecture 1 Welcome! 8 Lectures Slides posted on CS11 website http://www.cs.caltech.edu/courses/cs11 7-8 Lab Assignments Made available on Mondays Due one week later Monday, 12 noon
More informationCT 229. Java Syntax 26/09/2006 CT229
CT 229 Java Syntax 26/09/2006 CT229 Lab Assignments Assignment Due Date: Oct 1 st Before submission make sure that the name of each.java file matches the name given in the assignment sheet!!!! Remember:
More informationAnd Parallelism. Parallelism in Prolog. OR Parallelism
Parallelism in Prolog And Parallelism One reason that Prolog is of interest to computer scientists is that its search mechanism lends itself to parallel evaluation. In fact, it supports two different kinds
More informationBasics of Programming
Unit 2 Basics of Programming Problem Analysis When we are going to develop any solution to the problem, we must fully understand the nature of the problem and what we want the program to do. Without the
More informationChapter 1 INTRODUCTION SYS-ED/ COMPUTER EDUCATION TECHNIQUES, INC.
hapter 1 INTRODUTION SYS-ED/ OMPUTER EDUATION TEHNIQUES, IN. Objectives You will learn: Java features. Java and its associated components. Features of a Java application and applet. Java data types. Java
More informationWriting Program in C Expressions and Control Structures (Selection Statements and Loops)
Writing Program in C Expressions and Control Structures (Selection Statements and Loops) Jan Faigl Department of Computer Science Faculty of Electrical Engineering Czech Technical University in Prague
More informationPart I Part 1 Expressions
Writing Program in C Expressions and Control Structures (Selection Statements and Loops) Jan Faigl Department of Computer Science Faculty of Electrical Engineering Czech Technical University in Prague
More informationVLC : Language Reference Manual
VLC : Language Reference Manual Table Of Contents 1. Introduction 2. Types and Declarations 2a. Primitives 2b. Non-primitives - Strings - Arrays 3. Lexical conventions 3a. Whitespace 3b. Comments 3c. Identifiers
More informationLecture 02 C FUNDAMENTALS
Lecture 02 C FUNDAMENTALS 1 Keywords C Fundamentals auto double int struct break else long switch case enum register typedef char extern return union const float short unsigned continue for signed void
More informationOperators & Expressions
Operators & Expressions Operator An operator is a symbol used to indicate a specific operation on variables in a program. Example : symbol + is an add operator that adds two data items called operands.
More informationChapter 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 information1 Introduction Java, the beginning Java Virtual Machine A First Program BlueJ Raspberry Pi...
Contents 1 Introduction 3 1.1 Java, the beginning.......................... 3 1.2 Java Virtual Machine........................ 4 1.3 A First Program........................... 4 1.4 BlueJ.................................
More informationJava Programming Language. 0 A history
Java Programming Language 0 A history How java works What you ll do in Java JVM API Java Features 0Platform Independence. 0Object Oriented. 0Compiler/Interpreter 0 Good Performance 0Robust. 0Security 0
More informationChapter 1 Introduction to java
Chapter 1 Introduction to java History of java Java was created by by Sun Microsystems team led by James Gosling (1991) It was mainly used for home appliance, it later became a general purpose programming
More informationChapter 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 informationSpecial Topics: Programming Languages
Lecture #23 0 V22.0490.001 Special Topics: Programming Languages B. Mishra New York University. Lecture # 23 Lecture #23 1 Slide 1 Java: History Spring 1990 April 1991: Naughton, Gosling and Sheridan (
More informationOutline. Java Models for variables Types and type checking, type safety Interpretation vs. compilation. Reasoning about code. CSCI 2600 Spring
Java Outline Java Models for variables Types and type checking, type safety Interpretation vs. compilation Reasoning about code CSCI 2600 Spring 2017 2 Java Java is a successor to a number of languages,
More informationChapter 3: Describing Syntax and Semantics. Introduction Formal methods of describing syntax (BNF)
Chapter 3: Describing Syntax and Semantics Introduction Formal methods of describing syntax (BNF) We can analyze syntax of a computer program on two levels: 1. Lexical level 2. Syntactic level Lexical
More informationJava 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 informationIndex 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 informationJAVA 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 informationProgramming 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 informationCS 11 java track: lecture 1
CS 11 java track: lecture 1 Administrivia need a CS cluster account http://www.cs.caltech.edu/ cgi-bin/sysadmin/account_request.cgi need to know UNIX www.its.caltech.edu/its/facilities/labsclusters/ unix/unixtutorial.shtml
More informationJava Basic Programming Constructs
Java Basic Programming Constructs /* * This is your first java program. */ class HelloWorld{ public static void main(string[] args){ System.out.println( Hello World! ); A Closer Look at HelloWorld 2 This
More informationFundamental Data Types. CSE 130: Introduction to Programming in C Stony Brook University
Fundamental Data Types CSE 130: Introduction to Programming in C Stony Brook University Program Organization in C The C System C consists of several parts: The C language The preprocessor The compiler
More informationJava provides a rich set of operators to manipulate variables. We can divide all the Java operators into the following g roups:
JAVA BASIC OPERATORS http://www.tuto rialspo int.co m/java/java_basic_o perato rs.htm Copyrig ht tutorialspoint.com Java provides a rich set of operators to manipulate variables. We can divide all the
More informationChapter 1 GETTING STARTED. SYS-ED/ Computer Education Techniques, Inc.
Chapter 1 GETTING STARTED SYS-ED/ Computer Education Techniques, Inc. Objectives You will learn: Java platform. Applets and applications. Java programming language: facilities and foundation. Memory management
More informationChapter 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 informationAbout this exam review
Final Exam Review About this exam review I ve prepared an outline of the material covered in class May not be totally complete! Exam may ask about things that were covered in class but not in this review
More informationQUIZ. 1. Explain the meaning of the angle brackets in the declaration of v below:
QUIZ 1. Explain the meaning of the angle brackets in the declaration of v below: This is a template, used for generic programming! QUIZ 2. Why is the vector class called a container? 3. Explain how the
More informationOutline. Performing Computations. Outline (cont) Expressions in C. Some Expression Formats. Types for Operands
Performing Computations C provides operators that can be applied to calculate expressions: tax is 8.5% of the total sale expression: tax = 0.085 * totalsale Need to specify what operations are legal, how
More informationWeiss 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