A UNIX user named Bob wants to replace his chess program with a new one, but he
is not sure where the old one is installed. Bob is currently able to run a Java chess
program starting from his home directory /home/bob using the command:
Java -classpath /test:/home/bob/downloads/*.jar games.Chess
Bob's CLASSPATH is set (at login time) to:
/usr/lib:/home/bob/classes:/opt/java/lib:/opt/java/lib/*.jar
What is a possible location for the Chess.class file?
A. /test/Chess.class
B. /home/bob/Chess.class
C. /test/games/Chess.class
D. /usr/lib/games/Chess.class
E. /home/bob/games/Chess.class
F. Inside jarfile /opt/java/lib/Games.jar (with a correct manifest)
G. Inside jarfile /home/bob/downloads/Games.jar (with a correct manifest)答案是C,不知道怎么推出来的- -
我想不通。

解决方案 »

  1.   

    its like a puzzle. where you got it?
      

  2.   

    It's not a puzzle...It's a question of SCJP- -
      

  3.   

    /test后边好像不是分号? 跟Unix有关另外,好像是问possible,按习惯,应该是在 /test:/home/bob/downloads/*.jar 里,
    但没有:
    /home/bob/downloads/games/Chess.class 呀
      

  4.   


    wow, im joking.i just dont know how to work it out.  lol
      

  5.   


    Thank you for caring!let's wait for the "bull man" to conquer it!^_^
      

  6.   

    我到现在也没弄明白,SCJP原题考到了555~~
      

  7.   

    注意命令:
    Java -classpath /test:/home/bob/downloads/*.jar games.Chess
    使用了classpath参数会设置jvm的类加载路径,CLASSPATH中设置的类路径此时
    会被覆盖。而games.Chess,显然games是包名,Chess是类名,即Chess.class文件必在
    games/ 下;再加上classpath参数路径,那么Chess.class可能在
    /test/games/下; 或/home/bob/downloads/XXX.jar中
    故正确的答案应该是C、G