Click here to Skip to main content
15,886,873 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
My code -
int x = 6;
System.out.println ("Your number is:" + x);
Output- Your answer is:6

What I have tried:

I tried ("Your answer is:" + "" + x);
Posted
Updated 21-Jul-23 0:33am

1 solution

Change from
Quote:
System.out.println ("Your number is:" + x);
to
Java
System.out.println ("Your number is: " + x);
.

The "" is an empty string (not a blank). A blank is " ".
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900