Sunday, 10 October 2010

Java Week 2, Got it!

Success, java week 2 - All understood, just remember to add the "space +  space value" and the ;
package General;
public class Sums {
       public static void main(String[] args) {
       int num1 = 8;
       int num2 = 3;
       int answer;
      

       answer = num1 + num2;
       System.out.println ("Sum " + num1 + " / " + num2 + " = " + answer);
       answer = num1 * num2;
       System.out.println ("Value of " + num1 + " * " + num2 + " = " + answer);
       answer = num1 & num2;
       System.out.println("Remaining from " + num1 + " / " + num2 + " = " + answer);
       System.out.println ("Value of num1 is " + num1);
       System.out.println ( "Value of num2 is " + num2);
       num1 = num1 +1;
       System.out.println("Value of num1 is now " + num1);

       System.out.println ("I am now happy with the concept of this remember" +
               " to add the space + ");


    }
}

run:
Sum 8 / 3 = 0
Value of 8 * 3 = 24
Remaining from 8 / 3 = 0
Value of num1 is 8
Value of num2 is 3
Value of num1 is now 9
I am now happy with the concept of this remember to add the space +
BUILD SUCCESSFUL (total time: 0 seconds)

No comments:

Post a Comment