-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathThisDemo.java
More file actions
42 lines (32 loc) · 983 Bytes
/
ThisDemo.java
File metadata and controls
42 lines (32 loc) · 983 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
import java.util.Scanner;
public class ThisDemo {
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;
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);
}
}