TestBook - { public static void main(Stringargs) { Book one...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
class Book { private String title; private int pages; p public void setTitle(String t) { title = t; } public String getTitle() { return title; } public void setPages(int p) { pages = p; } public int getPages() { return pages; }} class TextBook extends Book { private int gradeLevel; p public void setGrade(int g) { gradeLevel = g; } public int getGrade() { return gradeLevel; }} public class TestBook
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: { public static void main(Stringargs) { Book one = new Book(); TextBook two = new TextBook(); one.setTitle("Algebra"); one.setPages(200); two.setGrade(11); System.out.println("Title:" + one.getTitle()); System.out.println("Pages: " + one.getPages()); System.out.println("Grade Level: " + two.getGrade()); }}...
View Full Document

This note was uploaded on 10/04/2010 for the course COMPUTER S 106 taught by Professor Moore during the Spring '08 term at Clark Atlanta.

Ask a homework question - tutors are online