///a calculator class the performs simple math. public class Calculator{ public Calculator(){ } public int add(int a,int b){ return a +b; } public int subtract(int a,int b){ return a - b; } public int multiply(int a,int b){ return a * b; } public int divide(int a,int b){ return a / b; } public int modulo(int a,int b){ return a % b; } public static void main(String[] args){ Calculator myCaculator = new Calculator(); System.out.println(myCaculator.add(5,7)); System.out.println(myCaculator.subtract(45,11)); } }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter