PDA

View Full Version : Why we are putting + sign in the start of variable and sometimes both ends variable



saneha
04-24-2011, 07:04 PM
Why we are putting + sign in the start of variable and sometimes at both ends of the variable?

For example:

System.out.println("Employee id:" +id+ "Name:" +name);

Vuhelper
04-24-2011, 07:04 PM
+ sign is used to concatenate values of variables with the string e.g. in your if id variable has value 3 then it would be concatenated as "Employee id:3"