Question

In Java, + can be used with integers as well as with strings. True or False?

In Java, + can be used with integers as well as with strings. True or False?

0 0
Add a comment Improve this question Transcribed image text
Answer #1

"+" operator can be used with integers as well as strings in Java. When we use + for integers then it adds two integer values and when we use + for strings it concatenate two strings.

So consider the below example here we are using + to concatenate two strings s1 and s2 and save the result into s3.

Run Debug Stop e Share A Save {}Beautify Language Java Main.java 1 public class Main 2 -{ public static void main(String[] ar

Similarly when we use + to add two integers example is

{} Beautify Language Java Run Debug Stop e Share A Save Main.java 1 public class Main 2 { public static void main(String[] ar

Add a comment
Know the answer?
Add Answer to:
In Java, + can be used with integers as well as with strings. True or False?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT