I’m not going to fix your code for you. Doing that is part of your homework. However, here are a couple of hints to start you in the right direction.
Hint: Look carefully at how your Reservation
constructor (tries to) initialize the object’s fields. See the problem?
Hint 2: The problem that tripped you up is that getguest()
is returning null
…….
While I have your attention, there are numerous style errors in your code, but the worst is your complete disregard of the Java converions for identifier names:
- A class name must start with a capital letter and be in camel-case:
Test
nottest
. - A method or variable name must start with a lower case and be in camel-case; e.g.
getGuest
notgetguest
. - We don’t need or use “hungarian” notation in Java. The type of a variable is expressed in the type declaration.
- Your choice of variable names is inconsistent and “uninspired”.
And “numb” is what happens when your fingers get cold.
2
solved How to call value of object inside object?