-
Notifications
You must be signed in to change notification settings - Fork 52
Expand file tree
/
Copy pathTask5.java
More file actions
29 lines (29 loc) · 713 Bytes
/
Task5.java
File metadata and controls
29 lines (29 loc) · 713 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
class Student {
private String name;
private String rollNo;
private String dept;
private int age;
Student (String rollNo, int age)
{
this.rollNo=rollNo;
this.age=age;
}
public void setData (String name, String dept)
{
this.name=name;
this.dept=dept;
}
public void getData()
{
System.out.println("Name: "+name);
System.out.println("Roll number: "+rollNo);
System.out.println("Age: "+age);
}
}
public class Task5{
public static void main (String[] args){
Student s1=new Student ("21SW129",19);
s1.setData("Sawera Saeed","Software");
s1.getData();
}
}