-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclass_object2.java
More file actions
32 lines (29 loc) · 832 Bytes
/
Copy pathclass_object2.java
File metadata and controls
32 lines (29 loc) · 832 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
package oop.basic;
import java.util.Scanner;
public class class_object2 {
private int x;
private int y;
private int z;
public void Input(){
Scanner objin = new Scanner(System.in);
System.out.print("Input value x :"); x=objin.nextInt();
System.out.print("Input value y :"); y=objin.nextInt();
System.out.print("Input value z :"); z=objin.nextInt();
}
private int sum(){
return x+y+z;
}
private int sub(){
return x+y/z;
}
public void Output(){
System.out.println("X :"+x+"\tY :"+y+"\tZ :"+z);
System.out.println("Sum :"+sum());
System.out.println("Sub :"+sub());
}
public static void main(String[] args) {
class_object2 cb = new class_object2();
cb.Input();
cb.Output();
}
};