Computer Science, asked by spartanhimanshu117, 9 months ago

why + operation is used in printin?see the attachment for question..​

Attachments:

Answers

Answered by dimple12341234
0

Answer:

Answer: However, the one argument may be a String which you create using the string concatenation operator +. If you ask to print an object, the print and println methods call that object's toString() method to get a printable string.

Explanation:The print method takes exactly one argument; the println method takes one argument or no arguments.Anything concatenated ("added") to a string is first converted to a string itself.

Answered by god286
3

You can see that it says "System.out.println("This is num" + num)

This means that it is joining 2 strings together. This can be used if you are creating a counter.

Example if "num" equals 2, this is what it would output: This is num 2

Clearly, it is a simple thing and I hope I explained it to you good. Thanks!

Similar questions