Book
class
The Once you have created a Gradle Java project in IntelliJ, you are ready to start developing the MyBooksApp. Our first step is to make a simple Book
class!
Notice Book
has a number of fields: title
, isbn
, publisher
, year
, and author
. All the other instance member methods are generated automatically by IntelliJ (custom constructor, setters & getters, toString
, equals
and hashCode
).
You should store the Book
class in a package called model
.
Java Packages
A package in Java is used to group related classes much like a folder in a file directory. By convention, package names are written in lower case.
Keep in mind that Gradle is opinionated about how your project must be structured. Although you can change the default structure, we advise that you keep on to it. You must, therefore, place your source code in src/main/java
and tests in src/test/java
.