Chapter 8 Characters In Java single characters are represented using the data type char. Character constants are written as symbols enclosed in single.

Slides:



Advertisements
Similar presentations
Lecture 9: Character and String
Advertisements

L2:CSC © Dr. Basheer M. Nasef Lecture #2 By Dr. Basheer M. Nasef.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved Fundamentals of Strings and Characters Characters.
©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 9: Characters * Character primitives * Character Wrapper class.
Chapter 9 Characters and Strings. Topics Character primitives Character Wrapper class More String Methods String Comparison String Buffer String Tokenizer.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Chapter 9 Characters and Strings (sections ,
Data types and variables
Primitive Types Java supports two kinds of types of values – objects, and – values of primitive data types variables store – either references to objects.
© 2000 McGraw-Hill Introduction to Object-Oriented Programming with Java--WuChapter Chapter 8 Characters and Strings.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Chapter 9 Characters and Strings (sections ,
Chapter 2 Data Types, Declarations, and Displays
1 Chapter 2: Elementary Programming Shahriar Hossain.
Data Representation in Computers
CS 180 Recitation 9/20/07 - 9/21/07. Announcements Exam 1 is Tuesday, September 25 th  Rooms: Sec WTHR 104 Sec MATH 175  Time: 7:00.
CHARACTERS Data Representation. Using binary to represent characters Computers can only process binary numbers (1’s and 0’s) so a system was developed.
Section 2 - More Basics. The char Data Type Data type of a single character Example char letter; letter = 'C';
© The McGraw-Hill Companies, 2006 Chapter 1 The first step.
L EC. 02: D ATA T YPES AND O PERATORS (1/2) Fall Java Programming.
Agenda Data Representation – Characters Encoding Schemes ASCII
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
Chapter 4: Representation of data in computer systems: Characters OCR Computing for GCSE © Hodder Education 2011.
Java Primitives The Smallest Building Blocks of the Language (corresponds with Chapter 2)
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Characters In Java, single characters are represented.
Characters In Java single characters are represented using the data type char. Character constants are written as symbols enclosed in single quotes, for.
Programming I Introduction Introduction The only way to learn a new programming language is by writing programs in it. The first program to.
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.
JAVA Tokens. Introduction A token is an individual element in a program. More than one token can appear in a single line separated by white spaces.
Data & Data Types & Simple Math Operation 1 Data and Data Type Standard I/O Simple Math operation.
Characters. Character Data char data type – Represents one character – char literals indicated with ' '
 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 the.
SEC (1.4) Representing Information as bit patterns.
Agenda ASCII char N int Character class char N String Bitwise operators homework.
Representing Characters in a computer Pressing a key on the computer a code is generated that the computer can convert into a symbol for displaying or.
The character data type char. Character type char is used to represent alpha-numerical information (characters) inside the computer uses 2 bytes of memory.
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.
CSCI 3133 Programming with C Instructor: Bindra Shrestha University of Houston – Clear Lake.
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,
Java Programming, Second Edition Chapter Two Using Data Within a Program.
1 Problem Solving using Computers “Data....Representation, and Storage.
Characters and Strings
Information Coding Schemes Group Member : Yvonne Tiffany Jurifah bt Junaidi Clara Jane George.
Problem Solving Intro to Computer Science CS1510 Dr. Sarah Diesburg 1.
Lecture Coding Schemes. Representing Data English language uses 26 symbols to represent an idea Different sets of bit patterns have been designed to represent.
1 Non-Numeric Data Representation V1.0 (22/10/2005)
© 2004 Pearson Addison-Wesley. All rights reserved August 27, 2007 Primitive Data Types ComS 207: Programming I (in Java) Iowa State University, FALL 2007.
Unit 2.6 Data Representation Lesson 2 ‒ Characters
Binary 1 Basic conversions.
Character coding schemes
Chapter 4 – Fundamental Data Types
Chapter 4 Mathematical Functions, Characters, and Strings
Primitive Data Types August 28, 2006 ComS 207: Programming I (in Java)
Representing Information as bit patterns
FATİH SULTAN MEHMET VAKIF UNIVERSITY Faculty of Engineering & Architecture Computer Engineering Department MAT217E - DİSCRETE STRUCTURES Slides for a.
Data Encoding Characters.
Coding Schemes and Number Systems
Agenda Warmup Lesson 2.5 (Ascii, Method Overloading)
Lecture 3 ISE101: Computing Fundamentals
Representing Characters
Primitive and Reference Data Values
Chapter 4: Mathematical Functions, Characters, and Strings
Computers & Programming Languages
String Encodings and Penny Math
Chapter 2: Basic Elements of Java
Intro to Computer Science CS1510 Dr. Sarah Diesburg
Intro to Computer Science CS1510 Dr. Sarah Diesburg
String Encodings and Penny Math
C Programming Language
ASCII and Unicode.
Ch 5 : Mathematical Functions, Characters, and Strings
Presentation transcript:

Chapter 8 Characters In Java single characters are represented using the data type char. Character constants are written as symbols enclosed in single quotes, for example, 'a', 'X', and '5'. To represent characters in computer, U. S. computer manufacturers devised several schemes for encoding characters as integers. One coding scheme widely used today is ASCII (American Standard Code for Information Interchange). Intro to OOP w/Java--Wu

Chapter 8 ASCII Table For example, character 'O' is 79 (row value 70 + col value 9 = 79). O 9 70 Intro to OOP w/Java--Wu

Character Translation Chapter 8 Character Translation Declaration and initialization char ch1, ch2 = ‘X’; Type conversion between int and char. System.out.println("ASCII of X is " + (int) 'X' ); System.out.println("Char 88 is " + (char)88 ); Erf … out to reality ASCIITranslate.java Intro to OOP w/Java--Wu

Character Comparison Spling … out to reality CharOrder.java Chapter 8 Character Comparison This comparison returns true because ASCII value of 'A' is 65 while that of 'c' is 99. ‘A’ < ‘c’ Spling … out to reality CharOrder.java Intro to OOP w/Java--Wu

Special Characters These are also known as “escape characters” Chapter 8 Special Characters These are also known as “escape characters” Written using a \ prefix \t \n \b \g \’ \\ Spling … out to reality EscapeCharacters.java Intro to OOP w/Java--Wu

The Character Class The Character class in the java.lang package includes methods for manipulating character values. Example, use isLetter to check if a character is a-z or A-Z Zzzznicka … out to reality … CharGames.java

Chapter 8 Unicode To accommodate the character symbols of non- English languages, the Unicode Consortium established the Unicode Worldwide Character Standard, commonly known as Unicode. Intro to OOP w/Java--Wu