The valueOf is fine, try entering the double with the "," for example 8.5 instead of the "." since your Locale is Spain. If you want it with the point indicate the Locale of another country where the point is used and it will not give you an error:
Scanner oNota = new Scanner (System.in).useLocale(Locale.US);
EDIT: Now that I notice the main can not go with Double
public static void main(String[] args) {
If you want to check that they are doubles to do something with them:
public static void main(String[] args) {
Double[] dbs=new Double[args.length];
String doublePatron = "([0-9]*)\.([0-9]*)";
for(int i=0;i<args.length;i++)
{
if(Pattern.matches(doublePatron, args[i]))
dbs[i]=Double.valueOf(args[i]);
else
dbs[i]=-1.0;
System.out.println(dbs[i]);
}
}
In this case if we execute:
java -jar JavaApplication6.jar 7.5 5.5 A
We would return by console:
7.5
5.5
-1.0
EDIT 2:
With this you pass from number to text from 0 to 9.9, if you need more it is simple.
public static void main(String[] args) {
Double[] dbs=new Double[args.length];
String doublePatron = "([0-9]*)\.([0-9]*)";
for(int i=0;i<args.length;i++)
{
if(Pattern.matches(doublePatron, args[i]))
{
String numeroEscrito="";
for(char c:args[i].toCharArray())
{
switch (c){
case '0':
numeroEscrito+="cero";
break;
case '1':
numeroEscrito+="uno";
break;
case '2':
numeroEscrito+="dos";
break;
case '3':
numeroEscrito+="tres";
break;
case '4':
numeroEscrito+="cuatro";
break;
case '5':
numeroEscrito+="cinco";
break;
case '6':
numeroEscrito+="seis";
break;
case '7':
numeroEscrito+="siete";
break;
case '8':
numeroEscrito+="ocho";
break;
case '9':
numeroEscrito+="nueve";
break;
case '.':
numeroEscrito+="con";
}
numeroEscrito+=" ";//faltaria quitarle el ultimo espacio
}
System.out.println(numeroEscrito);
}
else
System.out.println(args[i]+" no es un Double");
}
}
for:
java -jar JavaApplication6.jar 8.6 8.5 A
Da output:
ocho con seis
ocho con cinco
A no es un Double