Challenge: Build a Book Class

Create a Book class with:

  • title (String)

  • author (String)

  • pages (int)

Then, in your Main class:

  • Create an object of the Book class.

  • Assign values to its fields.

  • Print each field’s value.

Challenge: Build a Book Class

Create a Book class with:

  • title (String)

  • author (String)

  • pages (int)

Then, in your Main class:

  • Create an object of the Book class.

  • Assign values to its fields.

  • Print each field’s value.

Java
public class Book {
public static void main(String[] args) {
// Write your code here:
}
}