Tuesday, October 27, 2009

Netebans 6.8 available

The final release will be available in december.For now, you have the beta version.If you want to see the news of this version : Netbeans 6.8 beta

Friday, October 23, 2009

Exercice certification SCJP

Here is a small SCJP exercice to practice :


Given the following :

public class Test {

public int myTest = 2;
private String str;
public static void main(String [] args) {

for(int i=1;i<12;i++){
int myValue = 2;
System.out.println("great test !");
if (i== 5) {
myValue++;
System.out.println("myValue=" + myValue);
}
}
myValue++;
System.out.println("myValue=" + myValue);
}
}

What is the result ? (choose one)


A myValue=3 myValue=4

B myValue=3 myValue=3

C Compilation fails

D An exception is thrown at runtime









Solution

The solution is C because myValue exist only in for statement.

Friday, October 16, 2009

SCJP exercise : private, protected and public

Exercise :

public class Test {

public int myTest = 2;
private String str;
public static void main(String [] args) {
System.out.println("myTest=" + myTest);

}

}

What is the result ? (choose Two)

A myTest=2
B myTest=0
C Compilation fails
D An exception is thrown at runtime







Solution

C . The compilation will fail because we are in the main() method and we haven't instantiate Test.To make it working on solution should be :
Test monTest = new Test();
System.out.println("monTest=" + monTest.myTest);

Wednesday, October 14, 2009

The end of keyboard and mouse ? 10GUI

Here is a fun news !
R. Clayton Miller invents a new system for keyboard and mouse.
You can see a video on 10GUI

Saturday, October 10, 2009

SCJP exercise : identifiers

Exercise 1 :

Given the following :

public class Test {
public static void main(String [] args) {
int $test = 10;
System.out.println("$test=" + $test);

}

}

What is the result ? (choose Two)

A $test=10
B $test=null
C Compilation fails
D An exception is thrown at runtime


Exercise 2

Given the following :

public class Test {
public static void main(String [] args) {
int $2test = 10;
System.out.println("$2test=" + $2test);

}

}

What is the result ? (choose Two)

A $2test=10
B $test=null
C Compilation fails
D An exception is thrown at runtime














Solution Exercise 1 :

The solution is A. An identifier can begin with $ or _ .

Solution Exercice 2 :

The correct answer is A. An identifier can't begin with a number but can have a number.

Wednesday, October 7, 2009

SCJP exercices

Hi all,

I will publish some SCJP exercices next saturday and every week.
All comments will be appreciate !