Saturday, 30 January 2016

MATHEMATICAL OPERATORS IN JAVA.


  1. public class operators{
  2. public static void main(String args[]){
  3. int x = 44;
  4. int y = 89;
  5. System.out.println(x+y);
  6. System.out.println(x*y);
  7. System.out.println(y/x);//division
  8. System.out.println(y%x);//reminder
  9. }}

RESULT IN COMMAND  PROMPT:

click for large view






FIRST JAVA PROGRAM PRINTING STRING.

  1. public class Print{
  2. public static void main(String args[]){
  3. int x = 5;
  4. int y = 6;
  5. System.out.println(x + y); or System.out.println("x + y"); 
  6. }
  7. }