lesson_04.1

lesson_04.1 - Data Types and Operations On Data Objective...

Info iconThis preview shows pages 1–10. Sign up to view the full content.

View Full Document Right Arrow Icon
Data Types and Operations On Data Objective To understand what data types are The need to study data types To differentiate between primitive types and reference types To know the data range and storage requirements for each type To know the conditions for data conversion To know the permissible operations that can be performed on data To be able to evaluate expressions
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Data Types and Operations On Data Introduction Data Types Primitive Type Integral Type Floating Point Type Character Type Boolean Type Type Compatibility Reference Type Arithmetic Operator and Operations Arithmetic Expressions Relational Operator and Operations Relational Expressions Logical Operator and Operations Input and Output Operations
Background image of page 2
Data Types - Introduction The concept of data type is like what the bolts and nuts are to a piece of machinery . It is impossible to write meaningful program, without understanding: Data types, data values The amount of memory required for each type of data, and The permissible operations that can be performed on data
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Data Types - Introduction Like anything else, conservation of the use of memory is important. Some former languages did not consider conserving memory. Most of them had only two ways to store numeric values: int, for integers, and float, for floating point values. Hence wasting memory, especially when storing small values ; The amount of memory for each value, large or small, is the same.
Background image of page 4
Introduction – Data Types In the first section we: a) Study the fundamental data types in Java, and b) how they relate to programming. c) Focus on the operations that can be performed on each type. The second section introduces the reference type. This includes some of the fundamental Java classes, such as: a) The String class b) The Math class c) The wrapper classes
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
The Fundamental Types We had established that data is vital to a program. It must be stored in primary memory for the processor to handle it. The Java specifies two broad categories of data types: a) Primitive, and b) Reference type Primitive types are atomic They cannot be decomposed into simpler types Reference types are constructed from: a) Primitive types, b) As well as from other reference types
Background image of page 6
Data Types Data types Primitive types Reference types Integral types Floating Point boolean Integers byte short int long float double User defined classes Java classes char Boolean types Character
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Primitive Types Primitive types are atomic There are three types – integral, floating point, and boolean Integral – they can be represented by an integer value There are two groups – integer and character Integer – byte, short, int, long
Background image of page 8
Integer Type Data types Storage Required Range of Values byte 8 bits (byte) -128 to +127 short 16 bits (2 bytes)
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 10
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 01/06/2012 for the course COP 2250 taught by Professor Staff during the Fall '08 term at FIU.

Page1 / 39

lesson_04.1 - Data Types and Operations On Data Objective...

This preview shows document pages 1 - 10. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online