I am trying to write an elevator test program in java.
It is suppose to execute the following steps using the methods in the class:

1: Starting from the first-floor.
2: Go to 2nd (update bool GoingUp)
3: Go to 3rd
4: Back to second floor

This is what I have!

public class method {
public static void main(String[] args) {
direction currentfloor = new direction();
It's calling the class direction:
public class direction {
public void goDown()
System.out.println("Elevator is going down");

Now this part works good, but I am stuck with the second step where the new method GoingDown() is suppose to be a bool which i am not sure how to update or set it up, at least not in java :-/?

6 Years
Discussion Span
Last Post by stultuske

Sorry, this thread should be removed!
It was not formatted correctly.

Edited by eny321: n/a


in which case you do not remove threads, you edit the posts.
a method can not be a boolean, but it can have a boolean as a returnvalue.

when a method has a 'void' returnvalue, it means that it does not return anything.
if you want it to change a value, that can be returned, either you change the method so that it returns that value, or you set a value within that method, that can be called using a getter.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.