Created
August 15, 2014 16:33
-
-
Save moomoohk/3a9edfaa91fc2f158599 to your computer and use it in GitHub Desktop.
Calculator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class InstanceCalculator | |
{ | |
public dd(int num1, int num2) | |
{ | |
return num1 + num2; | |
} | |
public ubtract(int num1, int num2) | |
{ | |
return num1 - num2; | |
} | |
public static void main(String[] args) | |
{ | |
Calculator ourCalculatorObject = new Calcultor(); | |
int result = ourCalculatorObject.add(2, 2); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class StaticCalculator | |
{ | |
public static add(int num1, int num2) | |
{ | |
return num1 + num2; | |
} | |
public static subtract(int num1, int num2) | |
{ | |
return num1 - num2; | |
} | |
public static void main(String[] args) | |
{ | |
int result = Calculator.add(2, 2); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment