Java表达式中的双引号是什么意思?

双引号在Java中意味着什么?

我有:

"2 + 2" + 3 + 4 "hello 34" + 2 * 4 

有人可以解释如何评估这些表达式吗?

" "内的任何内容都将成为String 。 和string + Int = String例如,

 "2 + 2" + 3 + 4 

你会得到2 + 234

在你的问题中,

 "2 + 2" + 3 + 4 +"hello 34" + 2 * 4 //i added '+' between '4' and 'hello' since there is an error in expression 

将按如下方式评估:

 1. output = "2 + 2" + 3 + 4 +"hello 34" + 2 * 4 2. output = "2 + 2" + 3 + 4 +"hello 34" + 8 //operation '*' evaluated first 3. output = "2 + 23" + 4 +"hello 34" + 8 4. output = "2 + 234" +"hello 34" + 8 5. output = "2 + 234hello 34" + 8 6. output = "2 + 234hello 348"