gpt4 book ai didi

java - 在 Java GUI 中使用 Int

转载 作者:行者123 更新时间:2023-12-01 13:50:15 25 4
gpt4 key购买 nike

如何才能出现一个对话框,要求用户输入学生人数...(突出显示的部分)![在此处输入图像描述][1]

    JOptionPane.showMessageDialog(null, "Welcome");
JOptionPane.showMessageDialog(null, "Students mark Input Project");
JOptionPane.showMessageDialog(null, "In this program the user is going to enter the students name, class and marks.Then the program is going to output several information about each student.");
JOptionPane.showMessageDialog(null, "Class Information must be entered as the name of the class, the subject and the number of students");
String nameofclass = JOptionPane.showInputDialog("Enter the name of the class");
String nameofsubject = JOptionPane.showInputDialog("Enter the subject");
int numberofstudents =Integer.parseInt("Enter the number of students");
JOptionPane.showMessageDialog(null,"Class Students Information");
JOptionPane.showMessageDialog(null,"You must enter the name, surname and " + nameofsubject + " marks for each and every student in class "+ nameofclass);
StLuciaClassrooms theclass =new StLuciaClassrooms(nameofclass, numberofstudents);
theclass.enterInformation(numberofstudents);//

最佳答案

试试这个

 int numberofstudents =Integer.parseInt(JOptionPane.showInputDialog("Enter the number of students"));

关于java - 在 Java GUI 中使用 Int,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20018222/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com