-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPract.java
More file actions
36 lines (32 loc) · 822 Bytes
/
Copy pathPract.java
File metadata and controls
36 lines (32 loc) · 822 Bytes
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
class myPerson{
private String name;
private int age;
public void setter(int age,String name){
this.name=name;
this.age=age;
}
public int getage(){
return this.age;
}
public String getname(){
return this.name;
}
}
class myStudent extends myPerson{
double marks;
public void DisplayInfo(){
System.out.println("Name:"+this.getname());
System.out.println("Age:"+this.getage());
System.out.println("Marks:"+this.marks);
}
}
public class Pract{
public static void main(String[] args) {
myStudent stud=new myStudent();
String name="abdullah";
int age=18;
stud.marks=90;
stud.setter(age, name);
stud.DisplayInfo();
}
}