GoConqr has a new look! Let us know what you think.

Flashcards

Wrapper Classes

Nathan Hunsdale Programming 2 Masters of Science English 13 cards

Wrapper Classes

Cards in this deck (13)

  1. 1Wrapper Classes What does each of the 8 primitive data types have dedicated to it?A Class
  2. 2Wrapper Classes Why are they known as wrapper classes?They "wrap" the primitive data types into an object of that class
  3. 3Wrapper Classes What package are the wrapper classes a part of?java.lang
    (imported by default into all Java programs)
  4. 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)
  5. 5Wrapper Classes Declare an int... Declare an Integerint primitiveInt = 25;
    Integer wrapperInt = new Integer(25);
  6. 6Wrapper Classes with constructor detailsWrapper Classes with constructor details
  7. 7Wrapper Classes All wrapper classes except ______ can take ________ as an argument for example...1) Character
    2) String
    Integer num = new Integer("25");
  8. 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"
  9. 9Wrapper Classes Primitive data uses ==,<,> and wrapper classes use_________ and ________equals() and compareTo()
  10. 10What are the possible results from equals() or compareTo()?1, 0 ,-1
  11. 11Wrapper Classes write a compareTo statement...integer1.compareTo(integer2);
  12. 12Wrapper Classes Autoboxing and Auto-Unboxing What do these functions do?Provide automatic conversion TO and FROM the wrapper format
  13. 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

Feedback

What is it about?

What do you think of the new look?

How do you like it?