-
Notifications
You must be signed in to change notification settings - Fork 0
/
Superrrrrrrr.java
55 lines (54 loc) · 1.14 KB
/
Superrrrrrrr.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package practicetime;
import java.util.*;
public class Superrrrrrrr
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
System.out.print(" Enter Student's Name ");
String name=sc.nextLine();
System.out.print(" Enter Student's Class ");
int clas=sc.nextInt();
System.out.print(" Enter Book's Name ");
sc.nextLine();
String book=sc.nextLine();
System.out.print(" Enter Student's Age ");
int age=sc.nextInt();
sc.close();
Book s=new Book(name,clas,book,age);
s.display();
}
}
class Student
{
String name;
int clas;
void get (String name,int clas)
{
this.name=name;
this.clas=clas;
}
void display()
{
System.out.println(" Details of Student ");
}
}
class Book extends Student
{
String book;
int age;
Book(String name,int clas,String book,int age)
{
super.get(name,clas);
this.book=book;
this.age=age;
}
void display()
{
super.display();
System.out.println(" Student's Name : "+name);
System.out.println(" Student's Class : "+clas);
System.out.println(" Student's Age : "+age);
System.out.println(" Book's Name : "+book);
}
}