A new way to swap
In the Pair class, implement the swap method, which should swap the values of x and y. You can only use the following operations: 1) Exclusive or. 2) Assignment. 3) Exclusive-or assignment. Don't leave any comments. Don't change the rest of the code.
Let's find the highest power of 2
Implement the maxPowerOf2 method, which should return the highest power of 2 that fits into the passed number. The maxPowerOf2 argument can only be a positive integer. Use only the following operations: 1) Bitwise shifts. 2) Bitwise OR. 3) Bitwise AND. 4) Bitwise unary NOT.
Make one code change
Make one change to the program so that the output is always "ABC", even if null values are passed to the doSomething method. Don't change or add string literals. Don't change the lines that display data on the screen. Don't add setters.
Derive a specific number
Implement the createExpression(int number) method. The createExpression method has one parameter called number. This parameter is a number from 1 to 3000 inclusive. You need to display an arithmetic expression whose result is number.
GO TO FULL VERSION