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 :-/?

Recommended Answers

All 2 Replies

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

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.