What will the following code output? public class Book { public String title; public String author; public int pages; public Book(String bookTitle, String bookAuthor, int bookPages) { title = bookTitle; author = bookAuthor; pages = bookPages; } public void printBookInfo() { System.out.println("Title: " + title); System.out.println("Author: " + author); System.out.println("Pages: " + pages); } public static void main(String[] args) { Book book = new Book("The Great Gatsby", "F. Scott Fitzgerald", 180); book.printBookInfo(); } }




© 2024 Fiveable Inc. All rights reserved.
AP® and SAT® are trademarks registered by the College Board, which is not affiliated with, and does not endorse this website.

© 2024 Fiveable Inc. All rights reserved.
AP® and SAT® are trademarks registered by the College Board, which is not affiliated with, and does not endorse this website.