Hello,
I don't know why it s wrong
Someone can help me
package fr.codegym.task.task15.task1519;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
/*
Différentes méthodes pour différents types
*/
public class Solution {
public static void main(String[] args) throws IOException {
// écris ton code ici
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String readInput = "";
int value = 0;
while (true) {
readInput = reader.readLine();
if (readInput.matches("quitter")) {
break;
}
if (readInput.contains(".")) {
// System.out.println("string contains dot");
print( Double.parseDouble(readInput));
} else if ((readInput.matches("[\\-0-9]+") && readInput.length() > 1)) {
value = Integer.parseInt(readInput);
if (value > 0 && value < 128) {
// call with short
print((short) value);
} else if (value < 0 || value > 128) {
// call with integer
print(value);
}
} else {
// call string
print(readInput);
}
}
}
public static void print(Double value) {
System.out.println("C'est un Double. Valeur : " + value);
}
public static void print(String value) {
System.out.println("C'est un String. Valeur : " + value);
}
public static void print(short value) {
System.out.println("C'est un short. Valeur : " + value);
}
public static void print(Integer value) {
System.out.println("C'est un Integer. Valeur : " + value);
}
}