Answer:
The code to this question can be described as follows:
Code:
char c1,c2; //defining char variable
c1=passcode.charAt(0); // hold the value of first character
c2=passcode.charAt(1); // hold the value of first character
//defining conditional statement to check value
if(Character.isLetter(c1))// check character is alphabet
{
System.out.println("Alphabetic is available in 0 position:"); //print message
}
else if(Character.isLetter(c2))
{
System.out.println("Alphabetic is available in 1 position:"); //print message
}
Explanation:
Description of the code:
In the above code, two char variable "c1 and c2" is declared, in which these variable holds the first and second character value.
In the next step, if the conditional statement is used that check the input char is a letter or not.
To check these values "isLetter" method is used, that checks value is a letter or prints its location.