-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStudent.java
More file actions
37 lines (32 loc) · 962 Bytes
/
Student.java
File metadata and controls
37 lines (32 loc) · 962 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
37
import java.util.Scanner;
class Student
{
String name,address;
int age;
Student(String name,int age)
{
this("Agra");
this.name=name;
this.age=age;
}
Student(String address)
{
this.address=address;
}
void display()
{
System.out.println("Name is "+name);
System.out.println("Age is "+age);
System.out.println("Address is "+address);
}
public static void main(String[] args)
{
Scanner sc=new Scanner(System.in);
System.out.println("Enter Yr Name");
String name=sc.nextLine();
System.out.println("Enter Yr Age");
int age=sc.nextInt();
Student st=new Student(name,age);
st.display();
}
}