Topic: 为什么还要写那些字符串

  Print this page

1.为什么还要写那些字符串 Copy to clipboard
Posted by: zxz2004
Posted on: 2006-11-12 11:47

system.out.println("This is num: " + num)
system.out.println("The value of num * 2 is ")
为啥还要加这些This is num + num // The value of num * 2 is 字符串
何不直接了当的写这样
system.out.println(" num")
system.out.println(" num")

2.Re:为什么还要写那些字符串 [Re: zxz2004] Copy to clipboard
Posted by: zhangwensheng
Posted on: 2006-11-13 09:44

值通过变量名来引用,变量名代表值的存储地址
System.out.println(" num");
输出的是一个字符串 "num" 而不是num代表的值

3.Re:为什么还要写那些字符串 [Re: zxz2004] Copy to clipboard
Posted by: why
Posted on: 2006-11-13 19:43

run it and you could tell the difference.

if you don't want them, just don't do so.

4.Re:为什么还要写那些字符串 [Re: why] Copy to clipboard
Posted by: ningzhisheng
Posted on: 2006-11-13 19:55

这样只是为了表示两个num间的区别

5.Re:为什么还要写那些字符串 [Re: zxz2004] Copy to clipboard
Posted by: Revolution
Posted on: 2006-11-16 09:09

便于理解 直接写System.out.println(num);也没错


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923