-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathThisDemo1.java
More file actions
49 lines (37 loc) · 1.11 KB
/
ThisDemo1.java
File metadata and controls
49 lines (37 loc) · 1.11 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
49
import java.util.Scanner;
public class ThisDemo1 {
public static void main(String[] args) {
String name;
int rollno;
float fee;
Scanner sc = new Scanner(System.in);
System.out.println("Enter Student Name");
name= sc.nextLine();
System.out.println("Enter Student fees");
fee = sc.nextFloat();
System.out.println("Enter Student rollno.");
rollno = sc.nextInt();
Demo demo = new Demo();
demo.setValue(name,rollno,fee);
// demo.getValue();
}
}
class Demo {
String name;
int rollno;
float fee;
Demo(String name, int rollno, float fee){
this.name=name;
this.rollno=rollno;
this.fee=fee;
}
void setValue(String name, int rollno, float fee){
// System.out.println("The name is "+name+" Rollnumber is "+rollno+" Fees is " +fe);
this.name=name;
this.rollno=rollno;
this.fee=fee;
}
// void getValue(){
// System.out.println("The name is "+name+" Rollnumber is "+rollno+" Fees is " +fee);
// }
}