Learning java

This is slightly off topic .
As the title says, I am learning java. I am hoping to be able to use java next year in ludum dare.
As for now though. May I have some constructive criticism? Keep in mind I only have about an hours experience :3
Thanks! c:
import java.util.Scanner;

class apples{
public static void main (String args []) {
Scanner keyboard = new Scanner (System.in);
double fnum,snum,awns;
int operator,otherawns,modulus,tfnum,tsnum;
System.out.println(“Welcome to the basic Java calculator!”);
System.out.println(“Please enter the corresponding number for the operator you want, “);
System.out.println(“Division-1 Addition-2 Multiplication-3 Subtraction-4 or Division with remainders- 5 “);
operator= keyboard.nextInt();
if (operator == 1) {
System.out.println(“Enter first number”);
fnum = keyboard.nextDouble();
System.out.println(“enter second number: “);
snum = keyboard.nextDouble();
awns = fnum / snum;
System.out.println(awns);
}else{
if (operator == 2) {
System.out.println(“Enter first number”);
fnum = keyboard.nextDouble();
System.out.println(“enter second number: “);
snum = keyboard.nextDouble();
awns = fnum + snum;
System.out.println(awns);
}else{
if (operator == 3) {
System.out.println(“Enter first number”);
fnum = keyboard.nextDouble();
System.out.println(“enter second number: “);
snum = keyboard.nextDouble();
awns = fnum * snum;
System.out.println(awns);
}else{
if (operator == 4) {
System.out.println(“Enter first number”);
fnum = keyboard.nextDouble();
System.out.println(“enter second number: “);
snum = keyboard.nextDouble();
awns = fnum – snum;
System.out.println(awns);
}else{
if (operator == 5) {
System.out.println(“Enter first number”);
tfnum = keyboard.nextInt();
System.out.println(“enter second number: “);
tsnum = keyboard.nextInt();
modulus = tfnum % tsnum;
otherawns = tfnum / tsnum;
System.out.print(otherawns);
System.out.print(” and a remainder of “);
System.out.println(modulus);
}
}
}
}
}
}
}

Comments

TheColorMan
25. Apr 2013 · 09:23 UTC
Go to “codingbat.com” for awesome practice!
AngelDE98
25. Apr 2013 · 10:00 UTC
1. Use TAB key for readability of code.

2. Class names should be “Uppercase” or “CamelCase” not “lowercase”.
KristianGibson
25. Apr 2013 · 10:47 UTC
Thanks! Ima newbie to Java so I barely know anything xD
HakitoCZ
06. May 2013 · 12:18 UTC
“class apples”

Let me guess. Bucky, the new boston. 😀