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]

Some SCJP exercices soon

Hello world! This message is my reappearance on the blog. Due to some work and laziness I’ve been out of the project to share some of my experiences with all of you (knowlegde sharing is the beginning of something). You can’t go through life just learning, you have to teach, even if it’s just a little of what you know.

This is a very brief message just to try to give some advise to any developer who’s reading this to encourage you to get a certification. All of you know that in technology much of the workers are people who demonstrate their work in a practical approach more than in a resume or a degree. And that is good because the one who want does much more than the one who can. That fact, in general, talks us about the competitive that tech sector has. But we also know that sometimes we need a good backup and that is what the certification is about.

In the next few days I’m going to share with you some demo questions for the Oracle Certification Java Programmer or OCJP (in ancient times known as Sun Certification Java Programmer, SCJP) which these days is my hot topic. That being said it’s time to say good bye!
CLEAR YOUR MIND, BUT KEEP CODE ON!