繁体   English   中英

为什么我的程序没有运行? 我在 eclipse ide 并且它没有运行

[英]Why is my program not running? I am in eclipse ide and its not running

package inputoutputt;

import java.util.Scanner;

public class InputOutput {
public static void main(String[] args)  {
Scanner user_input  = new Scanner(System.in);
String firstname;
firstname= user_input.next();
System.out.print("Enter your first name:   ");
String middlename;
middlename = user_input.next();
System.out.print("Enter your middle name, if not type NA:  ");
String lastname;
lastname = user_input.next();
System.out.print("Enter your last namme:   ");
String dateofbirth;
dateofbirth = user_input.next();
System.out.print("Enter your date of birth in the following format(mm/dd/yy):    ");
String saone;
saone = user_input.next();
System.out.print("Enter your first/primary street address:                            ");
String satwo;
satwo = user_input.next();
System.out.print("Enter yoyr second/secondary street address if you have one, if not type NA:                      ");
String city;
city = user_input.next();
System.out.print("Enter your city of residence:          ");
String zipcode;
zipcode = user_input.next();
System.out.print("Enter your zipcode:      ");
String state;
state = user_input.next();
System.out.print("Enter your state:       " );
if(firstname==null) {
    System.out.print("You have not inputted your first name, please input:        ");
}
if(lastname==null) {
    System.out.print("You have not inputted your last name, please input:        ");
}
if(dateofbirth==null) {
    System.out.print("You have not inputted your date of birth, please input:        ");
}
if(saone==null) {
    System.out.print("You have not inputted your primary street address, please input:        ");
}
if(city==null) {
    System.out.print("You have not inputted your city, please input:        ");
}
if(zipcode==null) {
    System.out.print("You have not inputted your zipcode, please input:        ");
}
if(state==null) {
    System.out.print("You have not inputted your state, please input:        ");
}
}

}

我很确定我的代码是正确的,没有任何问题,但为什么它没有运行? 我使用 eclipse IDE 并且没有任何工作我以前做过这样的小程序,他们已经工作但由于某种原因它不是。 我做了一个 java 项目然后做了一个 class ,我很确定这是它,除非我错过了什么?

如果您想知道为什么它没有编译,那是因为您最后缺少一个括号。 如果您想知道为什么命令行中没有显示任何内容,那是因为您在询问用户名之前询问了用户输入。

前:

String firstname;
firstname= user_input.next();
System.out.print("Enter your first name:   ");

后:

System.out.print("Enter your first name:   ");
String firstname = user_input.next();

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM