Java tutorial#part3
Hello friends today we will discuss more on data types. So, let's start, if we write something like this: class main{ public static void main(String[] args){ int a=1; int b=2; System.out.println(a+b); } } Then the output will be: 3 !!!!Attention not: 12 But if we write something like this then: class main{ public static void main(String[] args){ int a=1; int b=2 System.out.println(a+""+b); } } Then the output will be: 12 Also the same with char & Strings. Here's the code class main{ public static void main(String[] args){ String i="hello"; String y="world"; System.out.println(i+" "+y); } } OUTPUT: hello world We can also arithmetical operations: class main{ public static void main(String[] args){ int a=3, b=2; System.out.println(a+b); System.out.println(a-b); System.out.println(a*b); System.out.println(a/b); } } OUTPUT: 5 1 ...