2._create_a_tree_class
The Java training online
2. Create a Tree class
Purpose: Write a complete class to describe a simple tree object.
Statement of the exercise:
- Add a new class in the
training
package, the class is namedTree
, with a single instance variable nameddbh
, in centimeters (diameter at breast height is the main dimension of a tree for foresters). Add a constructor takingdbh
in argument, a getter for thedbh
variable and atoString()
method displaying the tree dbh. - Add code in the main method of exercise 1. to create a tree with
dbh
5.6cm and print itstoString()
method to the terminal
2._create_a_tree_class.txt ยท Last modified: 2021/12/13 09:28 by 127.0.0.1