日期:2014-05-20  浏览次数:20780 次

几道java程序的题目,在线等。。。
Question     1
class   JMM119   {
        public   static   void   main   (String[]   args)   {
                int   i   =   0,   j   =   9;
                l1:
                do   {
                        l2:
                    if   (j   <   4)   {
                            break   l2;
                    }   else   if   (j--   <   7)   {continue;}
                   
                    i++;
                }   while   (i++   <   7);
                System.out.print(i   +   ", "   +   j);
        }
}
What   is   the   result   of   attempting   to   compile   and   run   the   program?  
a.     Prints:   4,7  
b.     Prints:   6,6  
c.     Prints:   6,5  
d.     Prints:   6,4  
e.     Prints:   7,5  
f.     Prints:   8,4  
g.     Run-time   error  
h.     Compile-time   error  
i.     None   of   the   above

Question     2
package   com.dan.chisholm;
public   class   A   {
    public   void   m1()   {System.out.print( "A.m1,   ");}
    protected   void   m2()   {System.out.print( "A.m2,   ");}
    private   void   m3()   {System.out.print( "A.m3,   ");}
    void   m4()   {System.out.print( "A.m4,   ");}
}    
class   B   {
    public   static   void   main(String[]   args)   {
        A   a   =   new   A();
        a.m1();     //   1
        a.m2();     //   2
        a.m3();     //   3
        a.m4();     //   4
}}
Assume   that   the   code   appears   in   a   single   file   named   A.java.   What   is   the   result   of   attempting   to   compile   and   run   the   program?  
a.     Prints:   A.m1,   A.m2,   A.m3,   A.m4,    
b.     Compile-time   error   at   1.  
c.     Compile-time   error   at   2.  
d.     Compile-time   error   at   3.  
e.     Compile-time   error   at   4.  
f. None   of   the   above

Question     3
class   GFM13   {