COMPSCI 61B Lecture Notes - Lecture 13: Avocado

54 views3 pages

Document Summary

Generic classes require us to provide one or more actual type arguments. Generics can"t hold primitive types (must use their respective reference type) Wrapper types and primitives can be used almost interchangeably. Arrays are never autoboxed or unboxed (integer[] can"t be used in place of int[]) Autoboxing / unboxing incurs a measurable performance impact. Wrapper types use much more memory than primitive types. Java objects have addresses that take up 64 bits and additional elds public static void bleepblorp(cid:383)(cid:384) { A value is promoted when it moves from a primitive type with a narrower range to a wider range (int to double) To move from a wider format to a narrower format, you must use casting (e. g. casting from double to int) An immutable data type is one for which an instance cannot change in any observable way after instantiation. The final keyword helps the compiler ensure immutability. You will assign a value only once (constructor or initializer)

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents