Unit 2 Test: Tues 11/3. ASCII / Unicode –Each letter, symbol, etc has a # value –See ascii table (in folder) –To convert a char into its ascii value,

Slides:



Advertisements
Similar presentations
CSci 1130 Intro to Programming in Java
Advertisements

CS110 Programming Language I
Chapter 3 DATA: TYPES, CLASSES, AND OBJECTS. Chapter 3 Data Abstraction Abstract data types allow you to work with data without concern for how the data.
Constants and Data Types Constants Data Types Reading for this class: L&L,
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved Fundamentals of Strings and Characters Characters.
Introduction to Computers and Programming Lecture 7:
Converting Between Numbers and Characters CSC 1401: Introduction to Programming with Java Week 4 – Lecture 3 Wanda M. Kunkle.
Java Syntax Primitive data types Operators Control statements.
Topic 6A – The char Data Type. CISC 105 – Topic 6A Characters are Numbers The char data type is really just a small (8 bit) number. As such, each symbol.
Working with the data type: char  2000 Prentice Hall, Inc. All rights reserved. Modified for use with this course. Introduction to Computers and Programming.
Primitive Types Java supports two kinds of types of values – objects, and – values of primitive data types variables store – either references to objects.
1 Chapter 2: Elementary Programming Shahriar Hossain.
Representation and Conversion of Numeric Types 4 We have seen multiple data types that C provides for numbers: int and double 4 What differences are there.
Fundamental data types Horstmann Chapter 4. Constants Variables change, constants don't final = ; final double PI = ; … areaOfCircle = radius *
JavaServer Pages Syntax Harry Richard Erwin, PhD CSE301/CIT304.
© 2006 Pearson Addison-Wesley. All rights reserved Reference Types A variable of reference type refers to (is bound to) an object Data of reference.
CSCI 1100/1202 January 16, Why do we need variables? To store intermediate results in a long computation. To store a value that is used more than.
The character data type char
Java Primitives The Smallest Building Blocks of the Language (corresponds with Chapter 2)
Characters The data type char represents a single character in Java. –Character values are written as a symbol: ‘a’, ‘)’, ‘%’, ‘A’, etc. –A char value.
1 Do you have a CS account? Primitive types –“ building blocks ” for more complicated types Java is strongly typed –All variables in a Java program must.
Primitive Types Java offers a number of primitive types eg.) int, short, long double, float char A variable which is declared as a primitive type stores.
Basic Java Syntax CSE301 University of Sunderland Harry R Erwin, PhD.
Java ProgrammingtMyn1 Java Programming Timo Mynttinen Mikkeli University of Applied Sciences.
CSE1222: Lecture 3The Ohio State University1. Assignment Operations  The C++ assignment operator is: =  Examples: x = 3 * 5; y = x – 7; y = y + 4; Do.
CISC105 – General Computer Science Class 9 – 07/03/2006.
C++ Loose ends from last time. Variable initialization You can do the usual things int x; x = 10; int y = 20; And you can do an unusual thing int x(10);
Assignment An assignment statement changes the value of a variable The assignment operator is the = sign total = 55; Copyright © 2012 Pearson Education,
Introduction to Programming
Basic Java Syntax COMP 401, Spring 2014 Lecture 2 1/14/2014.
The character data type char. Character type char is used to represent alpha-numerical information (characters) inside the computer uses 2 bytes of memory.
Vladimir Misic: Characters and Strings1Tuesday, 9:39 AM Characters and Strings.
Ch Chapter 4 Basic Data Types and Variables 4.1 Basic Data Types In C TABLE 4.1 Introduction to Basic Data Types in C Type SizeDescription char 1.
Copyright © – Curt Hill Types What they do.
Java Programming, Second Edition Chapter Two Using Data Within a Program.
A Simple Java Program //This program prints Welcome to Java! public class Welcome { public static void main(String[] args) { public static void main(String[]
School of Computer Science & Information Technology G6DICP - Lecture 4 Variables, data types & decision making.
Programming in Java (COP 2250) Lecture 4 Chengyong Yang Fall, 2005.
Road map char data type Reading –Liang 5: Chapter 2: 2.7.4; 2.9; –Liang 6: Chapter 2: 2.7.4; 2.9 –Liang 7: Chapter 2: 2.7.4; 2.9.
Recursion A recursive definition is one which uses the word or concept being defined in the definition itself Example: “A computer is a machine.
1.2 Primitive Data Types and Variables
Chapter 8 Characters and Strings. Objectives In this chapter, you will learn: –To be able to use the functions of the character handling library ( ctype).
Java – Variables and Constants By: Dan Lunney. Declaring Variables All variables must be declared before they can be used A declaration takes the form:
Overloading a constructor If a constructor is overloaded, then an if statement in the client is needed when creating the object. We have always declared.
Method OverloadingtMyn1 Method overloading Methods of the same name can be declared in the same class, as long as they have different sets of parameters.
Primitive Data Types 1 In PowerPoint, point at the speaker icon, then click the "Play" button.
COP2800 – Computer Programming Using JAVA University of Florida Department of CISE Spring 2013 Lecture 06 – Java Datatypes Webpage:
Basic Data Types & Memory & Representation. Basic data types Primitive data types are similar to JAVA: char int short long float double Unlike in JAVA,
Integer, Double, and Other Wrapper Classes … Sometimes a primitive value needs to be passed in as an argument, but the method definition creates an object.
1Object-Oriented Program Development Using C++ Built-in Data Types Data type –Range of values –Set of operations on those values Literal: refers to acceptable.
C LANGUAGE UNIT 3. UNIT 3 Arrays Arrays – The concept of array – Defining arrays – Initializing arrays.
Primitive Types Four integer types: Two floating-point types:
Basic Data Types & Memory & Representation
User Interaction and Variables
Types CSCE 314 Spring 2016.
Haskell Chapter 2.
Introduction to Computer Science / Procedural – 67130
Wel come.
Agenda Warmup Finish 2.4 Assignments
Multiple variables can be created in one declaration
Data Encoding Characters.
Wrapper Classes ints, doubles, and chars are known as primitive types, or built-in types. There are no methods associated with these types of variables.
Agenda Warmup Lesson 2.5 (Ascii, Method Overloading)
Conversions of the type of the value of an expression
Unit-2 Objects and Classes
Java Programming Language
Other types of variables
© A+ Computer Science - Variables & Data Types © A+ Computer Science - ©A+ Computer Science
2009 Test Key.
Lecture 36 – Unit 6 – Under the Hood Binary Encoding – Part 2
Presentation transcript:

Unit 2 Test: Tues 11/3

ASCII / Unicode –Each letter, symbol, etc has a # value –See ascii table (in folder) –To convert a char into its ascii value, type cast it into an integer, or save it in an integer variable. (The reverse can be done to convert an integer into its equivalent character.) –Demo: ascii

Method Overloading A method’s signature is its name and list of parameters. Method Overloading is when you use two methods with the same name, but different lists of parameters This is legal, as long as the parameters are different, in 1 of 3 possible ways: 1.Type 2.Number 3.Order

Why overload a method? Because sometimes you need to perform similar operations on different types of data –Demo: OverloadClass, OverloadClient A method’s return type is not part of its signature, so if 2 methods are only different in their return types, then Java won’t know the difference. This will cause an error.

Assignments P. 242 # (#13: “floating point” is another name for a double) (#18: hint: the if-statement should NOT be very long)