作者TonyQ (骨头)
看板java
标题Re: [问题] 几个书上习题的问题
时间Thu Feb 1 06:29:21 2007
※ 引述《[email protected] ()》之铭言:
: ※ [email protected] (失意男) wrote:
: > 另外 第二题:
: > 给定
: > class Alien{
: > String invade(short ship){return "a few"}
: > String invade(short... ship){return "many"}
: ^^^^^^^^^^^^^
: 这行怎麽回事= = 是我太久没写Java了吗...
: 这样Compile过的了?
那一行唯一过不了的地方只有在於 return "many" 後面要加分号。
属於 JDK 1.5 开始的多参数支援功能。
: > }
: > class Defender{
: > public static void main(String[] args){
: > System.out.println(new Alien().invade(7));
: > }}
: > 结果我选 a few 但答案是编译错误
: > 我知道如果 7 传入 long可以放宽
: > 7 传入 short难道不能自动转型?
: > 以上 望各位指点 m(_ _)m
: 我跟你说...你问的问题都可以自已写程式来验证一下的说
: 我去年也有考过SCJP (虽然是1.4滴= =||)
: 建议自已key过一次 这样可以加深印象喔
: 而且...有时候书上的答案不见得对...自已试过才知道XD
嗯......XD
--
String temp="relax"; | Life just like programing
while(buringlife) String.forgot(temp); | to be right or wrong
while(sleeping) brain.setMemoryOut(); | need not to say
stack.push(life.running); | the complier will
stack.push(scouting.buck()); | answer your life
stack.push(bowling.practice()); | Bone
everything
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 220.134.27.68