Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- /**
- * @version 18/11/17
- * @author Tobi salako
- * @aim
- */
- public class L06CharacterIndexFinder
- {
- public static void main(String[] args)
- {
- Scanner szKeyboard = new Scanner (System.in);
- String [] szAlphapet = {"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","v","w","x","y","z"};
- String szWord;
- int j = 0;
- System.out.println("Please enter a word of your choice: ");
- szWord=szKeyboard.nextLine();
- for(int i = 0; i < szWord.length(); i++ )
- {
- szWord.charAt(0);
- String string1 = Character.toString(szWord.charAt(0));
- if(string1.equals(szAlphapet[j]))
- {
- System.out.println("The character" +szWord.charAt(i) + " is in position "+j+"of the alphabet letter array");
- }
- j++;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement