Sunday, 15 September 2013

Comparing with getClass() when the other item is of a primative datatype

Comparing with getClass() when the other item is of a primative datatype

Is it possible to do something like the following
for (int i = 0; i < chararray.length; i++) {
Character myChar = new Character (chararray[i]);
if (myChar.getClass() == char) {
body of method;
}
}
Basically I want to test whether the value stored at position i of
chararray is of a certain datatype eg. is it A-Z or a number 1-100.
Thanks.

No comments:

Post a Comment