







Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
An overview of various java constructs covered in the object-oriented programming ii course at the university of maryland, college park's department of computer science. Topics include stream i/o, initialization blocks, variable initialization, annotations, bitset class, and two-dimensional arrays. Stream i/o covers the concept of streams, their usage, and examples. Initialization blocks discuss static and instance variable initialization, their motivation, and types. Variable initialization explains the different ways to initialize variables. Annotations introduce java constructs that add validity constraints to classes. The document also covers bitwise operators and the bitset class, as well as two-dimensional arrays of primitives and objects.
Typology: Study notes
1 / 13
This page cannot be seen from the preview
Don't miss anything!








โโโโ^ read and / or write Catch exceptions if needed
}^ // static initialization block static int A = 2;
// static variable declaration static {^ A = 3;
}^ // static initialization block {^ B = 4;^ }^
// initialization block private int B = 5;
// instance variable declaration {^ B = 6;^ }^
// initialization block Foo() {^
// constructor A = 7;B = 8;}
// now A = 7, B = 8 }^
// initializations executed in order of number
x^11010 y^10110 x and y 10010 or
x^11010 y^10110 x and y 11110 xor
x^11010 y^10110 x and y 01100 Java Bitwise operators^ & and^ |^ or^ ^ exclusive or^ ~ complement
Implements a vector of bits where the bits of the set are indexed bynonnegative integers Methods^ BitSet()^ โ New bit set^ BitSet(int nbits)
and^ between the current object and the set parameter (current object is updated with the result) or(BitSet set)^ โ Performs logical
or^ between the current object and the set parameter (current object is updated with the result) cardinality()^ โ Returns number of bits set to 1 flip(int bitIndex)
) โ Returns true if the bit at bitIndex is set; false otherwise length()^ โ Index of the highest set bit + 1. It returns zero if the BitSet containsno bits set. size()^ โ Number of bits space used by the BitSet to represent bit values toString()^ โ For every bit set, the decimal representation of that index isincluded in the result. Example (See Computers.java)