Formatting code may be purely aesthetic, but it makes it a lot easier to read and find things like misplaced and/or missing closing brackets.
Besides some simple indents, a couple of comments I added to your code should show you where your problem lies
class Book {
int stockNum;
String author;
String title;
double price;
int pages;
public int getStockNum() { return stockNum; }
public void setStockNum(int stockNum) { this.stockNum = stockNum; }
public String getAuthor() { return author; }
public void setAuthor(String author) { this.author = author; }
public String getTitle() { return title; }
public void setTitle(String title) { this.title = title; }
public double getPrice() { return price; }
public void setPrice(double price) { this.price = price; }
public int getPages() { return pages; }
public void setPages(int pages) { this.pages = pages; }
public Book() { super(); }
public Book(int stockNum, String author, String title, double price, int pages) {
super();
this.stockNum = stockNum;
this.author = author;
this.title = title;
this.price = price;
this.pages = pages;
}
@Override public String toString() {
return "Stock Number: " + stockNum + ", Author: " + author + ", Title: " + title + ", Price: " + price + ", Pages: " + pages;
}
}
class TextBook extends Book{
private int gradelevelbook;
public int getGradelevelbook() { return gradelevelbook; }
public void setGradelevelbook(int gradelevelbook) { this.gradelevelbook = gradelevelbook; }
public class BookApplication {
public void main(String[] args) {
Book book1 = new Book();
book1.setAuthor("Chad");
book1.setPages(390);
book1.setPrice(345);
book1.setStockNum(2);
book1.setTitle("Intro to C++");
TextBook tb1=new TextBook();
tb1.setGradelevelbook(3);
tb1.setAuthor("dennis ritchie");
tb1.setPages(566);
tb1.setPrice(200);
tb1.setStockNum(5);
tb1.setTitle("Java beginer");
System.out.println(book1.getAuthor()+" "+book1.getPages()+" "+book1.getPrice()+" "+book1.getStockNum()+" "+book1.getTitle());
System.out.println(tb1.getAuthor()+" "+tb1.getPages()+" "+tb1.getPrice()+" "+tb1.getPrice()+" "+tb1.getStockNum()+" "+tb1.getTitle()+" "+tb1.getGradelevelbook());
}
}
}