Java Quiz #39

If you're not getting your athletic body's tanned on a beach this week, here is a small quiz to keep your brain fit.
What does this code snippet do ?

  1. public class Quiz39 {
  2.  
  3. public static void main(String[] args) {
  4. int[] array = null;
  5. try {
  6. array[0] = array[(array = createArray())[array.length - 1]];
  7. } finally {
  8. System.out.println("Array = " + Arrays.toString(array));
  9. }
  10. }
  11.  
  12. public static int[] createArray() {
  13. return new int[]{1, 2, 3, 4};
  14. }
  15.  
  16. }
Lire la suite...

Paris JUG "Holly Cummins"

Le Paris JUG accueille pour sa séance du mois de juin un invité de marque, en la personne de Holly Cummins.

Holly présentera deux séances ce soir :

  • Java Performance Tuning - not so scary after all
  • OSGi and the Enterprise: A match made in a… box?

Vous trouverez ci-dessous une retranscription en temps réel de la conférence, sous la forme d'une Wave. N'hésitez pas à participer !
(PS : Google Wave est désormais en accès libre, si vous n'avez pas de compte il vous suffit de vous inscrire !)

Lire la suite...

Java Quiz #38

Can you help the poor Exception to escape the Matrix ?
Beware, the Agents are nearby and will spot you if you attempt in any way to modify or remove the existing lines of code ! (but you may add new ones).

  1. public class Matrix {
  2. public static void getTheSpoon() {
  3. throw new java.lang.NoSuchMethodException("There is no spoon !");
  4. }
  5. }
  1. public class Test {
  2. public static void main(String[] args) {
  3. try {
  4. Matrix.getTheSpoon();
  5. } catch (Exception ex) {
  6. System.out.println(ex instanceof java.lang.NoSuchMethodException ? "You passed the Quiz !" : "You failed !");
  7. }
  8. }
  9. }
Lire la suite...