Hi,
I am currently experiencing some difficulties with an array index out of bounds exception.
Here are the lines that bug:
- if (TableauTampon[0]==0 && TableauTampon[1]==0){
- TableauTampon[0]=42;
- }
It could happen that
TableauTampon[1] does not exist. In this case there is an exception which is thrown. However in the other case (when
TableauTampon[1] exist) this test is crucial so I can't just just dropt it.
So the idea I had was to code a try / catch like this:
- try {
- if (TableauTampon[0]==0 && TableauTampon[1]==0){ // On passe l'une des deux valeurs à 1042 ...
- TableauTampon[0]=1042;
- }
- }catch (IOException e) {
- e.printStackTrace();
- }
But the compiler tell me that it can't reach catch block for IO exceptions.
Any ideas how to solve this problem?
1