lecture2 - PIC 20A Lecture 2: Data Types, Variables,...

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

View Full Document Right Arrow Icon
PIC 20A Lecture 2: Data Types, Variables, Classes, Methods, Objects, References
Background image of page 1

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

View Full DocumentRight Arrow Icon
Java Data Types • primitive data types – char 'a', '3', '\n', '\uffff' 16-bit unicode – boolean true,false – byte -128 to 127 – short -32,768 to 32,767 16-bit – int -2,147,483,648 to 2,147,483,647 32-bit – long -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 64-bit – float single precision 32-bit – double double precision 64-bit • object references
Background image of page 2
What is a Java variable? • a memory location that stores a value for later use in the program • has a fixed type (eg cannot store an object reference in a variable of type int ) • has an identifier • must be initialized by a value before it is used
Background image of page 3

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

View Full DocumentRight Arrow Icon
• a name for a variable, method, or a class. • consist of letters, digits, _, and $ • cannot start with a digit • conventions: – do not use $ characters – make them descriptive of what they represent –use camel notation – begin w/ lowercase letter for variables and methods
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 16

lecture2 - PIC 20A Lecture 2: Data Types, Variables,...

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

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