- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
Latest commit
51 lines (46 loc) · 1012 Bytes
/
Copy pathMain.java
File metadata and controls
51 lines (46 loc) · 1012 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
importjava.util.Scanner;
//class Student
//{
// String name="Meet";
// int age=18;
// int roll_no=31;
//}
//public class Main
//{
// public static void main(String[] args)
// {
// Student obj=new Student();
// System.out.println("The Name is:"+obj.name);
// System.out.println(obj.age);
// }
//}
classStudent
{
Stringname="Meet";
intage;
introll_no;
voidStudent_Data(Strings,intz,intx)
{
name=s;
roll_no=z;
age=x;
}
voiddisplay()
{
System.out.println("The Name is:"+name);
System.out.println("The age is:"+age);
System.out.println("The roll No is:"+roll_no);
}
}
publicclassMain
{
publicstaticvoidmain(String[] args) {
Studentobj=newStudent();
obj.Student_Data("Meet Kotadiya",18,31);
obj.display();
System.out.println();
Studentobj2=newStudent();
obj2.Student_Data("Harsh",19,12);
obj2.display();
}
}