SCJP preparation execises #001

Given the following code:

public class Foo {
    static void method(int...x) {
         // insert code here
    }
}

Which code fragment, inserted independently at line 12, will allow the class to compile?
1. for each(x) System.out.println(x);
2. for(int z : x) System.out.println(z);
3. while( x.hasNext()) System.out.println( x.next());
4. None of the above

Answer

Option 2 is correct

[collapse]

Published by

Alí Adame

I'm an enthusiastic of technology as a way to improve life quality and bring progress to every person and organizations. My actual interest are based on software and web development and project management. || Soy un entusiasta de la tecnología como medio para lograr una mejor calidad de vida y progreso en todas las personas y las organizaciones. Mis intereses personales se centran en desarrollo de software, desarrollo web y administración de proyectos.

Leave a Reply

Your email address will not be published. Required fields are marked *