Java OCA OCP Practice Question 646

Question

Which line(s) in the following code will cause a compilation error?

static import java.lang.System .*; //1 
class $$ //2 
{ 
    static public void main (String... _$_) //3 
    { /*from   w w w.j  ava  2 s. c  om*/
       String _ = ""; //4 
       for (int $=0; ++$ < _$_ .length; )  //5 
           _ += _$_ [$];  //6 
       out.println (_);  //7 
     } 
} 

Select 1 option

  • A. 1
  • B. 2
  • C. 3
  • D. 4
  • E. 5
  • F. 6
  • G. 7
  • H. None of the lines is invalid.


Correct Option is  : A

Note

The order of static and import is invalid.

It should have been "import static".

Everything else is legal!




PreviousNext

Related