You are on page 1of 3

Experiment No. 1.

Student Name:Abhinov Kumar Roy UID: 21BCS9952


Branch: B.E(CSE) Section/Group: 802-B
Semester: 3rd Date of Performance:26-08-2022
Subject Name: OOPs using Java Subject Code: 21CSH-218

Aim of the practical: You have to create another class that extends the abstract class. Your task
is to write just the MyBook class.

Objective: In this challenge, we're going to use abstract class to create subclass of MyBook.

Program Code:

import java.util.*;
abstract class Book{
String title;
abstract void setTitle(String s);
String getTitle(){
return title;
}
}

class MyBook extends Book{


void setTitle(String s){
this.title = s;
}
}

public class Main{

public static void main(String []args){


Scanner sc=new Scanner(System.in);
String title=sc.nextLine();
MyBook new_novel=new MyBook();
new_novel.setTitle(title);
System.out.println("The title is: "+new_novel.getTitle());
sc.close();

}
}

Output:

Learning outcomes (What I have learnt):

1. I have learnt how to make abstract class in java.

2. I have learnt how to use this word in java.

3. I have learnt how to make subclass with the help of abstract class.
Evaluation Grid :

Sr. No. Parameters Marks Obtained Maximum Marks


1. Student Performance 12
(Conduct of experiment)
objectives/Outcomes.
2. Viva Voce 10
3. Submission of Work Sheet 8
(Record)
Total 30

You might also like