//Name: Mane Mauli Kundalik
//Class:SE DIV:3 Batch:B
//Roll no: 205C041
//Assignment no: 2
//Title:Create a java program demonstrating single inheritance where a
subclass extends a super class and calls its methods.
//PROGRAM:
package inheritence;
import [Link];
class teacher
private
Scanner input=new Scanner([Link]);
String name;
int cr_no;
int t_id;
void getdata()
[Link]("Enter name of Teacher: ");
name=[Link]();
[Link]("Enter Classroom no of Teacher: ");
cr_no=[Link]();
[Link]("Enter Teacher ID: ");
t_id=[Link]();
void display()
[Link]("Name of Teacher: "+name);
[Link]("ID of Teacher: "+t_ID);
[Link]("Classroom of Teacher: "+cr_no);
class student extends teacher
Scanner input =new Scanner([Link]);
String sname;
int ID;
double marks;
void get()
[Link]();
[Link]("Enter name of student: ");
sname=[Link]();
[Link]("Enter ID of student: ");
id=[Link]();
[Link]("Enter marks of student: ");
marks=[Link]();
void put()
[Link]();
[Link]("Name of student: "+sname);
[Link]("ID of student: "+ID);
[Link]("marks of student: "+marks);
public class single_inheritence {
public static void main(String[] args) {
student s1=new student();
[Link]();
[Link]();
//OUTPUT:
Enter name of Teacher:
VIRAT
Enter classroom no of Teacher:
32
Enter Teacher ID:
10112
Enter name of Student:
YASH
Enter ID of Student:
190210
Enter Marks of Student:
94.67
Name of Teacher: VIRAT
ID of Teacher: 10112
Classroom of Teacher: 29
Name of Student: YASH
Id of Student: 190210
Marks of Student: 94.67