Next page | Contents page |

Exercise 12 - instanceof

Which of these expressions evaluate to true?

  1. "String" instanceof String
  2. new Exception () instanceof Throwable
  3. 42 instanceof Integer
  4. new Integer (42) instanceof java.lang.Number
  5. new Double (1.2E30) instanceof java.math.BigDecimal
  6. new int [42] instanceof int []
  7. new int [] { 2 } instanceof byte []
  8. new byte [] { 100, 200, 300 } instanceof Object
  9. array [12] instanceof Object
  10. "" instanceof Object
  11. null instanceof String
  12. new StringBuffer ("xyz") instanceof String
  13. x instanceof Object
Next page | Contents page |