Thursday, February 25, 2010

Linux 2.6.33 released !

New linux kernel version : Annonce
If you want to have more details see : survey


Eclipse survey

An interesting survey about eclipse's use in the world was publish.It shows that Linux is use more and more (Linux 43%, Windows 41%).We learn also that Subversion is the source control that is the most use.And to finish,  89% of users are happy to use eclipse.Here is the complete survey :


SurveyEclipse


Wednesday, February 24, 2010

SCJP exercise : operators

Exercise :

public static void main(String [] args) {

int val = 5;
if ( (val && 7) == 2) {
System.out.println("Good");
} else {
System.out.println("Bad");
}
}

A Good
B Bad
C Compilation fails
D An exception is thrown at runtime










Solution :


The solution is C.The && oeprator can be use only with boolean.

Monday, February 22, 2010

Android

In this time, I prepare a blog about android.In this blog we will learn together android.I don't know android.So I will learn with you and I will put all my notes on my android blog : androidKillerApps

Wednesday, February 17, 2010

SCJP exercise : instanceof

Exercise :

public class Test {

public static void main(String [] args) {

Integer test = new Integer(5);
if (null instanceof Integer) {
System.out.println("null is an integer");
} else if ( test instanceof Integer) {
System.out.println("test is an integer");
} else {
System.out.println("Hello");
}
}

}


What is the result ? (choose one)

A
null is an integer
B test is an integer
C
Hello
D Compilation fails
E An exception is thrown at runtime





Solution :


The solution is B.You can write null instanceof integer with no compilation error.

Wednesday, February 10, 2010

SCJP exercise : enum

Exercise :

public class Test {

enum Animal { "CATS", "DOGS", "ELEPHANT"};
public static void main(String [] args) {

Animal myAnimal = Animal.CATS;
if ( myAnimal == Animal.CATS) {
System.out.println("It's a CATS");
} else if (myAnimal.equals(Animal.DOGS)) {
System.out.println("It's a DOGS");
} else {
System.out.println("It's an elephant");
}
}

}


What is the result ? (choose one)

A It's a CATS
B It's a DOGS
C It's an elephant
D Compilation fails
E An exception is thrown at runtime





Solution :


The solution is D.There is an compilation error because the enum syntax is wrong.
It should be : enum Animal { CATS, DOGS, ELEPHANT};

Wednesday, February 3, 2010

SCJP exercise : enum

Exercise :



Given the following :

public class Test {

enum Animal { CATS, DOGS, ELEPHANT};
public static void main(String [] args) {

Animal myAnimal = Animal.CATS;
if ( myAnimal == Animal.CATS) {
System.out.println("It's a CATS");
} else if (myAnimal.equals(Animal.DOGS)) {
System.out.println("It's a DOGS");
} else {
System.out.println("It's an elephant");
}
}

}


What is the result ? (choose one)

A It's a CATS
B It's a DOGS
C It's an elephant
D Compilation fails
E An exception is thrown at runtime






Solution :


The solution is A.There is no errors.You can use enum with == or with the method equals.