The code is listed here:
import java.util.Scanner;
public class InputCharacterInfo {
public static void main(String[] args) {
Scanner keyboard = new Scanner(System.in);
System.out.print("Enter a character...");
String variableChar;
char aChar;
variableChar = Character.toString(aChar);
variableChar = keyboard.nextLine();
System.out.println("The character is " + aChar);
if(Character.isUpperCase(aChar))
System.out.println(aChar + " is uppercase");
else
System.out.println(aChar + " is not uppercase");
if(Character.isLowerCase(aChar))
System.out.println(aChar + " is lowercase");
else
System.out.println(aChar + " is not lowercase");
aChar = Character.toLowerCase(aChar);
System.out.println("After toLowerCase(), aChar is " + aChar);
aChar = Character.toUpperCase(aChar);
System.out.println("After toUpperCase(), aChar is " + aChar);
if(Character.isLetterOrDigit(aChar))
System.out.println(aChar + " is a letter or digit");
else
System.out.println(aChar +
" is neither a letter nor a digit");
if(Character.isWhitespace(aChar))
System.out.println(aChar + " is whitespace");
else
System.out.println(aChar + " is not whitespace");
}
}
My problem entails that I need to identify the char variable "aChar" as a String which I put as "variableChar", however I've run into a point where I do not know what to define the char "aChar" as without removing the ability of the user to input. User input is crucial for this assignment.
I've tried moving around the char aChar;
statement multiple times, also tried changing the definition of "variableChar". Resulted in the char not being defined, the rest of the code not working, or the String not reading properly.