著名的真题中的一题,没看明白。
schol 2006-05-18 01:36:16 QUESTION NO:2
1. public class Test {
2. static boolean foo(char c) {
3. System.out.print(c);
4. return true;
5. }
6. public static void main( String[] argv ) {
7. int i =0;
8. for ( foo('A'); foo('B')&&(i<2); foo('C')){
9. i++ ;
10. foo('D');
12. }
13. }
14. }
What is the result?
A. ABDCBDCB
B. ABCDABCD
C. Compilation fails.
D. An exception is thrown at runtime.
for ( foo('A'); foo('B')&&(i<2); foo('C')) 这句不太明白?
答完正确,马上给分,谢谢!