Workday interview question

Code how to do a pre-order traversal in Java