Loading
notes intro/old submit AP Problems the dump links
 

Create a simply integer class called EasyInt that will keep track of one integer:

  • so have a global int variable
  • have two constructors:
    • a. with no paramater such that when constructed have its value automatically set to 0
    • b. with one parameter where when constructed have its value set to the parameter
  • have a method called setValue that will take in a number and set the global value to that
  • have a method called getValue
  • have a method called isEven which will return true or false
  • have a method called toString

Now try predicting the output here.

Here is the code as another class. Look through it and then run it.

Lets play with references. Try this worksheet out.

 

What did you learn?

 

Now lets try with this code: