CMSC 132A Midterm: CMSC 132A - Term Test 2

77 views72 pages

Document Summary

Unit 2: week 7-13: midterm 2: characters and strings, creating and using packages, using packages. Throwing: abstract classes and visitor classes, visitor pattern rehash, visitor class, a library class. Six degrees of kevin bacon fun: a new data structure, hashcode: the hash table, comparable, bucket list, iterators, lists in general, quiz: implementation of the comparable, midterm 2 review. Most of the time, if you are using a single character value, you will use the primitive char type. // unicode for uppercase greek omega character char unichar = "\u03a9"; // an array of chars char[] chararray = { "a", "b", "c", "d", "e" }; There are times, however, when you need to use a char as an object for example, as a method argument where an object is expected. The java programming language provides a wrapper class that wraps the charin a character object for this purpose. An object of type character contains a single field, whose type is char.