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

Slides:



Advertisements
Similar presentations
L2:CSC © Dr. Basheer M. Nasef Lecture #2 By Dr. Basheer M. Nasef.
Advertisements

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.
©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.
ASCII and Unicode. ASCII Inside a computer, EVERYTHING is a number – that includes music, sound, and text. In the early days of computers, every manufacturer.
CHARACTERS Data Representation. Using binary to represent characters Computers can only process binary numbers (1’s and 0’s) so a system was developed.
The Data Element. 2 Data type: A description of the set of values and the basic set of operations that can be applied to values of the type. Strong typing:
Section 2 - More Basics. The char Data Type Data type of a single character Example char letter; letter = 'C';
L EC. 02: D ATA T YPES AND O PERATORS (1/2) Fall Java Programming.
Representing text Each of different symbol on the text (alphabet letter) is assigned a unique bit patterns the text is then representing as.
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
©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 9 Characters and Strings.
Java Primitives The Smallest Building Blocks of the Language (corresponds with Chapter 2)
Computer Structure & Architecture 7c - Data Representation.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Characters In Java, single characters are represented.
Programming I Introduction Introduction The only way to learn a new programming language is by writing programs in it. The first program to.
C-Language Keywords(C99)
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.
College Board A.P. Computer Science A Topics Program Design - Read and understand a problem's description, purpose, and goals. Procedural Constructs -
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.
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.
17-Mar-16 Characters and Strings. 2 Characters In Java, a char is a primitive type that can hold one single character A character can be: A letter or.
1.  Algorithm: 1. Read in the radius 2. Compute the area using the following formula: area = radius x radius x PI 3. Display the area 2.
Introduction to computer science Lec2 cs111. Extended Binary Coded Decimal Interchange Code (EBCDIC) is an 8- bit character encoding used mainly on.
Lecture Coding Schemes. Representing Data English language uses 26 symbols to represent an idea Different sets of bit patterns have been designed to represent.
Unit 2.6 Data Representation Lesson 2 ‒ Characters
Binary 1 Basic conversions.
Chapter 4 Mathematical Functions, Characters, and Strings
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.
CS1010 Programming Methodology
Coding Schemes and Number Systems
Agenda Warmup Lesson 2.5 (Ascii, Method Overloading)
Data Representation Question: Characters
Primitive and Reference Data Values
Chapter 4: Mathematical Functions, Characters, and Strings
Chapter 8 Characters In Java single characters are represented using the data type char. Character constants are written as symbols enclosed in single.
Computers & Programming Languages
Digital Encodings.
Intro to Computer Science CS1510 Dr. Sarah Diesburg
The Data Element.
The Data Element.
C Programming Language
ASCII and Unicode.
Ch 5 : Mathematical Functions, Characters, and Strings
Presentation transcript:

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

ASCII Table For example, character 'O' is 79 (row value 70 + col value 9 = 79). O 9 70

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

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

Special Characters These are also known as “escape characters” Written using a \ prefix \t \n \b \g \’ \\ Spling … out to reality EscapeCharacters.java

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 Zzzznicka … out to reality … CharGamesCompressed.java

Unicode To accommodate the character symbols of non- English languages, the Unicode Consortium established the Unicode Worldwide Character Standard, commonly known as Unicode.