java - evaluating variable int/string -


  int x = 20; Double d = 3.1416; String s = "h";   

These are my variables and I have to evaluate the next rows.

  d / x + "";   

is evaluating the double variable type (0.15708), is that correct?

If you do not have that pesky "" !

Finally add "" to something like this in a string it can actually be an easy shortcut - String.valueOf Instead of using something like () , you can do that 4/2 + "" , which makes it in a string.

Repeat,

d / x will be a double , because you are adding a floating point < P> but a double + "" = string .

I hope that helps. Good luck :)

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -