How can i make the program to tell the user what letter of the alphabet it is:
ex: " k is the 11th letter in the alphabet"
here is the code that i got so far

import javax.swing.*;
public class Ncom{
String Inputnum;
char num;
public static void main(String[] args){
new Ncom();
public Ncom(){
char []upper = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
char []lower = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
Inputnum=JOptionPane.showInputDialog("Enter a letter");
num= Inputnum.charAt(0);

if (Character.isUpperCase(num))

System.out.println(num+" is Upper case");
System.out.println(num+" is Lower case");



Thank you

Arrays.binarySearch(array,char) gives the index

try this

if (Character.isUpperCase(num)){
System.out.println(num+" is Upper case");
System.out.println("Index is = "+(Arrays.binarySearch(upper, num)+1));
System.out.println(num+" is Lower case");
System.out.println("Index is = "+(Arrays.binarySearch(lower, num)+1));

you can use the ascii

int num = Char_input ; 
if (num >= 65 && num <= 90 ){
S.O.P("is upper case" + " \nindex " +num-64 );

and the same for lower case
this algorithm is more efficient than yours no search in it