Java Classes Introduction Exercises

  < Previous  Next >
  1. Look at Java's SE (Standard Edition) API (Application Programming Interface). Everything we do in this class will probably be in the "java.base" module, so click on that. We'll be primarily using the following packages:
    • java.io
    • java.math
    • java.io
    • java.util
    Click on one of the above packages. Now, find a class that looks interesting but basic. For example, if you choose java.util, then you could choose "Random". Skim over the documentation. Remember what class you choose for a future quiz (and what module and package) it belongs to.
  2. What is the difference between:
    • private
    • protected
    • public
  3. It is generally a best programming practice to specify instance variables as private. Discuss with someone why that is.
  4. When would you want to make a method be private?. Discuss your thoughts with someone else.