In this recipe, we will make use of predefined Java class definition files and import them into JShell. Then, we will play around with those classes in JShell.
Object-oriented programming in JShell
How to do it...
- The class definition files we will use in this recipe are available in Chapter12/4_oo_programming, in the code downloads for this book.
- There are three class definition files: Engine.java, Dimensions.java, and Car.java.
- Navigate to the directory where these three class definition files are available.
- The /open command allows us to load the code from within a file.
- Load the Engine class definition and create an Engine object:
- Load the Dimensions class definition and create a Dimensions object:
- Load the Car...