The file name is BookDemo.java and I compiled it like this: javac bookpack\BookDemo.java
This is my block of code:
package bookpack;
class Book {
private String title;
private String author;
private int pubDate;
Book(String t, String a, int d) {
title = t;
author = a;
pubDate = d;
}
void show() {
System.out.println(title);
System.out.println(author);
System.out.println(pubDate);
System.out.println();
}
}
class BookDemo {
public static void main(String args[]) {
Book books[] = new Book[5];
books[0] = new Book("Java: A Beginner's Guide",
"Schildt", 2011);
books[1] = new Book("Java: The Complete Reference",
"Schildt", 2011);
books[2] = new Book("The Art of Java",
"Schildt and Holmes", 2003);
books[3] = new Book("Red Storm Rising",
"Clancy", 1986);
books[4] = new Book("On the Road",
"Kerouac", 1955);
for(int i=0; i < books.length; i++) books[i].show();
}
}
The output is this:
javac: file not found:bookpack\BookDemo.java Usage: javac <options> <source files>
use -help for a list of possible options
How can you fix this so that the code will execute? Thank you for your help!!!