QUOTE(pbl @ 14 Oct, 2008 - 09:20 PM)

Question not very clear... if I guess from your topic title:
you can always always read a String from the scanner and then try to convert it to int
CODE
boolean isNumber;
int nb = 0;
// read String
String str = sc.next();
// try to convert it to int
try {
nb = Integer.parseInt(str);
isNumber = true;
}
catch(NumberFormatException e) {
isNumber = false;
}
// test if conversion worked
if(isNumber) {
... it is a number
}
else {
... was other text
}
actually my question is.. how can i use 'java scanner' to differentiate integer and string when its all together been insert at one time.. for example..
System.out.println("Enter Student's name and marks: ");
so we must enter " edward 20"-----> 'edward' for name ----> '20' for marks
so how can i use java scanner to differentiate 'edward 20 ' whether 'edward' or '20' are string in order to put 'edward' into 'arrayname' and 20 into 'array marks'?
*arraymarks is integer array
*arrayname is string array