首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > J2SE开发 >

classpatch的迷糊~解决办法

2012-01-28 
classpatch的迷糊~~~Question 217Given:1. package com.company.application2.3. public class MainClass

classpatch的迷糊~~~
Question 217
Given:
1. package com.company.application;
2.
3. public class MainClass {
4. public static void main(String[] args) { }
5. }
And MainClass exists in the /apps/com/company/application directory.
Assume the CLASSPATH environment variable is set to “.“ (current
directory). Which two java commands entered at the command line
will run MainClass? (Choose two.)
A. java MainClass if run from the /apps directory
B. java com.company.application.MainClass if run from the /apps
directory
C. java -classpath /apps com.company.application.MainClass if run
from any directory
D. java -classpath . MainClass if run from the
/apps/com/company/application directory
E. java -classpath /apps/com/company/application:. MainClass if run
from the /apps directory
F. java com.company.application.MainClass if run from the
/apps/com/company/application directory
  -
答案:BC
应该是BD吧?E中的冒号改成分号是不是可以?


[解决办法]
类的真正名称, 永远都是包含包名的。 


此类就是叫做 com.company.application.MainClass

任何企图将它叫做MainClass的行为都是错误的

热点排行