Hey all, just writing up this little bit of code and now am a bit confused? all i now want to do insert the argument acquired from the Keyboard.readchar() command into my method via the calling of an object i.e. new? My IDE says its found my return type boolean but a char is required, but I already have a return in my method? Here is my code anyway (it doesn't like the char n = ..........etc line). Hope someone ca help?
package Chapter4;
import cs1.Keyboard;
//Always start with Capitals - Java synatx
public class IsAlpha {
//Creates a new instance of IsAlpha
////This is also a constructor(no return type) and same name as the class.
public IsAlpha(){
}
public boolean isalphabetic(char c){
if (Character.isLetter(c)){
return true;
}
else{
return false;
}
}
public static void main(String[]args){
System.out.println("Please insert a character of your choice: ");
char a = Keyboard.readChar();
IsAlpha charinp = new IsAlpha();
char n = charinp.isalphabetic(a);
System.out.println(n);
}
}