Skip to main content

Output for the program "10"+20+30

Output for the program "10"+20+30


If we add a string literal before any other datatype such as integer or float etc then the compiler will treat all other datatypes as a string and the output that will be printed is 
102030

output for the program "10"+20+30

The compiler will simply concatenate the string and will print the output.

But on the other side, If we add the integer values before and the string literal later on then the compiler will add both of the integer values and concatenate the string literal. In this case, the output that will be printed by the compiler is 5010.
output for the program "10"+20+30



Comments

Popular posts from this blog

Difference between px,dip,dp and sp in Android

Difference between px,dip,dp and sp in Android MEANING px   -> It stands for pixel and has a same meaning to the resolution of the screen density. it corresponds to the actual pixel in the screen. dip ->Dip and dip both are one and the same thing.It stands for density independent pixel.It is dependent on physical intensity pixel of screen. sp  It stands for scaled pixel. USAGE px It is used with the images to resize the image.used to fit the image to screen and change the size of the image.

Concatenation Of String

Concatenation Of String #include<iostream.h> #include<conio.h> #include<string.h> void main() { clrscr(); string str1="programming"; string str2="hub"; string str3; int len; str3=str1; cout<<str3; str3=str1+str2; cout<<str3<<endl; len=str3.size(); cout<<len<<endl; getch(); }

What is Java

     What Is JAVA?    Java is a General Purpose, platform independent, Concurrent, very Fast, and most Important Object Oriented  Programming  Language  General Purpose :  Implies That It's Not Constrained To One Particular Domain and it can be Used to a wide variety of applications. Object Oriented :  It helps  to interact with more real-life scenarios in a more natural way.  Platform Independent: it   helps to run the java code on every platform. java mantra is write once run anywhere that is writing a program once a new must be able to run it. Concurrent Programming : which is nothing but multithreading Andits enables programs to perform multiple activities at the same time is also very fast and it is almost indistinguishable.  These are the some core attributes of java which make the java really a solid and very reliable and a complete programing language. it i...