summaryrefslogtreecommitdiff
path: root/oop/06-static-properties/Calculator.java
blob: 7ec28517b9a7b00335c9b157cebd551f2a798fad (plain)
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
public class Calculator {
	public static int x; // static (class) field
	public int y; // instance field
	
	public static int add(int a, int b) { // static (class) method
		return a + b;
	}
	
	public static int subtract(int a, int b) {  // static (class) method
		return a - b;
	}
	
	public static double convertFromC2F(double cTemp) {  // static (class) method
		return cTemp*180/100 + 32.0;
	}
	
	public void setY(int y) { // instance method
		this.y = y;
	}
	
	public int getXxY() { // instance method
		return x * y;
	}
	
//	public static int getXxY2() {
//		return x * y;
//	}
}