Download presentation
Presentation is loading. Please wait.
1
Programming Fundamentals
Data and Data Types Programming Fundamentals
2
Today’s activity A “container” is a named location in memory.
When we said: String message; we were building a container in memory that would hold String sized values. int number; builds an int sized container to hold integers.
3
Examples If we build an int container using the declaration, int sum;
the container can only hold ints or anything smaller.
4
An int container can hold:
int sum; sum 25 192 2,647,189 2,147,483,647 An int container cannot hold: These values are too “big” or incompatible with an int. << too big as how it is represented 2,147,483, << too big “something” << incompatible true << incompatible
5
An int container can hold anything smaller:
int sum; byte number; number = (byte) 125; sum number 125 number sum 125 sum = number; 125 sum But we can’t go the other way around. 125 number number = sum;
6
Worksheet Spend a few minutes with your team working through the worksheet. Turn the GROUP response into the folder. The lab will have you practice with what happens as you assign values to different kinds of containers.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.