import javax.swing.JOptionPane;
public class MyJavaProgramTask4Exercise3 {
public static void main(String[] args) {
String Namestudent, studentID;
Namestudent = JOptionPane.showInputDialog("Type in a student name: ");
studentID = JOptionPane.showInputDialog(null, "Type in the correspondng ID number: ");
int the_index;
System.out.println(Namestudent + " " +studentID);
System.out.println(Namestudent.charAt(studentID));
}
}
我被告知要编写一个程序,允许用户输入学生 ID 号,然后输入全名,我这样做了,我坚持这一点,以创建一个新字符串,其中包含名称中的字符用于索引身份证号码的每个数字...
我正在尝试让 charAt 使用用户输入的学生 ID 作为索引参考来显示 Namestudent 的字符,但这不起作用,我需要做什么,谢谢