Java Java Objects Harnessing the Power of Objects Constants

Reem Javaid
Reem Javaid
861 Points

A few questions AND feedback!

Hi guys,

hope someone can help me:

1) shouldn't it be in this order: final public static int MAX_PEZ = 12; similar to: final private String characterName;

2) What is an INSTANCE Variable? What is an INSTANCE? Is it the Object, in this case, the dispenser?

3) What is %d?

The Java Basics course was a breeze, but now I'm finding it difficult to grasp the material. There are so many terms used in the one video that it makes it difficult for me to keep up with what the instructor is saying. Getting really discouraged at this point! Is it just me? Should I keep going?

3 Answers

Jason Thomas
Jason Thomas
8,495 Points

An access modifier i.e. "public" or "private" will typically be first.

public static final int MAX_UNITS = 25;

I would go back and review then keep going, or go to another resource and then come back and keep going...or both. But don't give up. Persistence pays off and some ideas just take a bit longer to solidify.

Steve Lewin
Steve Lewin
1,181 Points

For #3, the %d is just like the %s, where s is for string but d is for whole numbers like int. %f is also used for floats (i.e. doubles)

Michelle Buckby
Michelle Buckby
35,605 Points

Awesome , I did wonder how one would know if they were needing to use %s, %d, or %n etc as seen in this course. Is there a name for these ? (So that I can search for a table that will clarify each one etc?) Thank you

Michelle Buckby
Michelle Buckby
35,605 Points

ha, answered my own question! https://en.wikipedia.org/wiki/Printf_format_string useful for anyone else who was curious :)