U2L03 - int v Integer
This lesson drills what Trevor teaches in U2L01, U2L02, and U2L03
So if some of this is confusing, be sure to review any of these 3 lessons, to clarify what is drilled below.
Pre-requirements:
- Follow this for all drills explainer
- Or this if you haven't even installed the drills yet installation
Summary of what is drilled
A Disciplined Approach? holds that these items should never again allow any confusion in your mind about this list of what Trevor covered in this lesson:
- Declaring a variable
- Assigning a value to a variable
- Consuming a variable within a method invocation
- Invoking a method
- (implicit) Case sensitivity
- Object v primitive
- Objects and properties
- Using +, -, / and * operators on an int
Whew! That's a lot to cover for the first drill!
In addition, we add unit testing, something that isn't even covered in the lessons!
For all these reasons and more, you may wish to reach out to an instructor or a video, or another student - in order to get through this first drill the first time.
Also for that same reason, you may wish to regenerate and repeat this drill many many times until it feels really solid.
Declaring Variables and Assigning Values
- There are several variables which are consumed by the tests when the
assertEquals()
or another assert method is invoked. - These variables do not compile in your Eclipse app because they have not been declared.
- You must declare each variable and assign it an appropriate value.
- This video shows this actual drill being corrected and run.
A strategic sequence:
One strategy that works well on some drills is to comment out all asserts except the top one.
Focus on getting that one assert to first compile, and then to run green.
Then, uncomment the next assert and get that to comile, and then run green.
Repeat with each assert until drill is complete and running green.
For this drill only
All drills are designed to be tackled in your own time and generally without assistance. Figuring stuff out is the essence of this coursework, and the answers are in Trevor's lessons.
However ... This first drill might be overwhelming for some bootcampers to tackle without assistance. Please seek out help from your foundations instructors or from other bootcampers, if necessary, on this first drill.