1/15/08 Notes

To Notes

CSC 212 -- 1/15/08

 

Review Questions

  1. Convert the signed one byte hex value DA to twos complement binary and decimal.

    Ans: DA hex --> 11011010 bin --> -38 dec.

  2. Convert the signed one byte hex value 1F to twos complement binary and decimal.

    Ans: 1F hex --> 00011111 bin --> 31 dec.

  3. Convert the decimal number -46 to signed one byte binary and hex.

    Ans: -46 dec --> 11010010 bin --> D2 hex.

  4. What is a perfect number?

    Ans: It a number where the sum of its factors equals the number.

  5. What are amicable numbers?

    Ans: n and m are amicable numbers if the sum of factors of n equals m and the sum of factors of m equals n.

  6. How do you test in Java whether m is a factor of n?

    Ans: if (n % m == 0)

  7. What is a method?

    Ans: It is a function or procedure.

  8. What is a static method?

    Ans: It is a method that is called directly from the class. No object is required. A nonstatic method requires an object.

  9. What is a constructor?

    Ans: A special method that creates an object.

  10. What is an instance variable?

    Ans: A global variable that is defined inside of an object, outside of any method. The instance variables of an object define the state of the object.

 

The Revised Perfect Example

 

The Java Class Libraries

 

UML Diagrams

 

Some Builtin Java Classes