Advertisement
tampurus

1 Basic operators

Apr 2nd, 2022 (edited)
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.52 KB | None | 0 0
  1. // Q 1,2
  2. public class MyClass {
  3.     public static void main(String[] args) {
  4.         System.out.println("Hello World");
  5.         int a = 10, b = 5;
  6.         // Using of +,-,*,/
  7.         System.out.println("Sum = "+(a+b)+", Substraction = "+(a-b)+", Multiplication = "+(a*b)+", Division = "+(a/b));
  8.         // + on strings
  9.         String s1 = "Suresh" , s2 = " is a cool boy";
  10.         System.out.println(s1+s2);
  11.     }
  12. }
  13. /*
  14. Hello World
  15. Sum = 15, Substraction = 5, Multiplication = 50, Division = 2
  16. Suresh is a cool boy
  17. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement