-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathStudent.java
More file actions
48 lines (44 loc) · 1.02 KB
/
Copy pathStudent.java
File metadata and controls
48 lines (44 loc) · 1.02 KB
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
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package hackerrank;
/**
*
* @author Jayit
*/
import hackerrank.Person_details;
import hackerrank.Person;
import java.util.Scanner;
public class Student extends Person implements Person_details
{
String name;
String grade;
Student(String n)
{
super(n);
grade="";
}
public void getGrade(String g)
{
grade=g;
}
@Override
public String getDetails()
{
super.see();
return grade;
}
public static void main(String args[])
{
Scanner sc= new Scanner(System.in);
System.out.println("Enter name: ");
String n=sc.nextLine();
Student p1=new Student(n);
System.out.println("Enter grade: ");
String g=sc.nextLine();
p1.getGrade(g);
System.out.println("The grade is "+p1.getDetails());
}
}