Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package pkgday3;
- public class Q7 {
- int bookID=101;
- String title="Gelvin";
- String author ="abc";
- double price=60;
- public static void main(String[] args) {
- Periodical e = new Periodical();
- e.display();
- e.modify();
- e.display();
- }
- }
- class Periodical extends Q7{
- String period = "Weekly";
- void modify(){
- this.period="Monthly";
- this.price=50;
- }
- void display(){
- System.out.println("Details: "+this.period+ " "+this.price);
- }
- }
Add Comment
Please, Sign In to add comment