Java Programming Tutorial - Building a Basic Calculator





import java.util.Scanner; 
public class apples{
public static void main(String args[]) {
Scanner thileban = new Scanner (System.in);
double fnum, snum, answer;
System.out.println("Enter first num: ");
fnum = thileban.nextDouble(); 
System.out.println("Enter second num: ");
snum = thileban.nextDouble();
answer = fnum+snum;
System.out.println(answer);
} }

Comments