Class Notes (839,236)
Canada (511,223)
IAT 265 (12)

IAT265 Datatypes.docx

3 Pages

Interactive Arts & Tech
Course Code
IAT 265
Matt Lockyer

This preview shows page 1. Sign up to view the full 3 pages of the document.
Datatypes Primitive Types int-integers (whole numbers) between -2,147,483,648 and 2,147,483,647 float-floating point numbers (decimal numbers) char-a single character byte-integers between -127 and 128 boolean-true or false Declaring int xPosition; declares a new variable xPosition of type int float yPosition; declares a new variable yPosition of type float char myFirstInitial; declares a new variable myFirstInitial of type char byte numOfApples; declares a new variable numOfApples of type byte boolean lightOn; declares a new variable lightOn of type boolean -variables should be in camelCase with no spaces or characters Initializing xPosition = 40; sets the variable xPosition to 40 yPosition = 40.5; sets the variable yPosition to 40.5 myFirstInitial = 'M'; sets the variable myFirstInitial to M *note the single quote numOfApples = 8; sets the variable numOfApples to 8 lightOn = true; sets the variable lightOn to true Declaring and Initializing float yPosition = 40.5; declare and initialize variable yPosition to 40.5 Variables must be assigned only values that their type will accept E.g. Cannot assign a string literal to a character Cannot assign an integer to a boolean Strings String hello; declares a variable of type String named hello hello = "Hello"; initializes the String hello to equal "Hello" String hello = "Hello"; declaration and initialization in one line String Operations Concatenation-the ability to add one string to the beginning or end of another String hello = “Hello “; String user = "Matt"; String helloUser = hello + user; helloUser -> "Hello Matt" String byeUser = "Bye " + user; byeUser -> "Bye Matt" Char At and Length-the ability to pick out a character at a specific position and retrieve its length String
More Less
Unlock Document

Only page 1 are available for preview. Some parts have been intentionally blurred.

Unlock Document
You're Reading a Preview

Unlock to view full version

Unlock Document

Log In


Join OneClass

Access over 10 million pages of study
documents for 1.3 million courses.

Sign up

Join to view


By registering, I agree to the Terms and Privacy Policies
Already have an account?
Just a few more details

So we can recommend you notes for your school.

Reset Password

Please enter below the email address you registered with and we will send you a link to reset your password.

Add your courses

Get notes from the top students in your class.