Flashcards
Wrapper Classes

Cards in this deck (13)
- 1Wrapper Classes What does each of the 8 primitive data types have dedicated to it?A Class
- 2Wrapper Classes Why are they known as wrapper classes?They "wrap" the primitive data types into an object of that class
- 3Wrapper Classes What package are the wrapper classes a part of?java.lang
(imported by default into all Java programs) - 4Wrapper Classes What are the 2 primary purposes?1) Wrap primitive values into an object for more functionality (e.g. be added to ArrayLists)
2) Provide a lot more utility functions (e.g. converting ints to and from Strings) - 5Wrapper Classes Declare an int... Declare an Integerint primitiveInt = 25;
Integer wrapperInt = new Integer(25); - 6Wrapper Classes with constructor details

- 7Wrapper Classes All wrapper classes except ______ can take ________ as an argument for example...1) Character
2) String
Integer num = new Integer("25"); - 8Wrapper Classes What is the NumberFormatException?When someone tries to pass the number spelled out as a string rather than the integer form
e.g. "two" instead of "2" - 9Wrapper Classes Primitive data uses ==,<,> and wrapper classes use_________ and ________equals() and compareTo()
- 10What are the possible results from equals() or compareTo()?1, 0 ,-1
- 11Wrapper Classes write a compareTo statement...integer1.compareTo(integer2);
- 12Wrapper Classes Autoboxing and Auto-Unboxing What do these functions do?Provide automatic conversion TO and FROM the wrapper format
- 13Wrapper Classes Autoboxing int m = 20; Integer objM; How would I box int m?objM = m;
Information
- Description
- Masters of Science Programming 2 Flashcards on Wrapper Classes, created by Nathan Hunsdale on 28/05/2014.
- Created by
- Nathan Hunsdale
- Views
- 16
- Rating