Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Book2 {
- private String title;
- private int numPages;
- public void setTitle(String text){
- title=text;
- }
- public String getTitle(){
- return title;
- }
- public void setNumPages(int num){
- numPages=num;
- }
- public int getNumPages(){
- return numPages;
- }
- }
- public class Textbook extends Book2{
- private int gradeLevel;
- public void setGradeLevel(int grade){
- gradeLevel=grade;
- }
- public int getGradeLevel(){
- return gradeLevel;
- }
- }
- public class Demobook {
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- Textbook bookobj = new Textbook();
- bookobj.setTitle("Intro to Java");
- bookobj.setGradeLevel(11);
- bookobj.setNumPages(100);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment