问题描述
因此,我正在尝试在Eclipse上构建电子邮件Admini应用程序,但是存在一个问题 有。控制台显示:
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
email cannot be resolved to a type
at emailapp.EmailApp.main(EmailApp.java:6)
这是我在2个班级中已经编写的代码:
打包emailapp;
公共类EmailApp {
public static void main(String[] args) {
Email em1 = new email("Goanar","Rambang");
}
}
public class Email {
private String firstName;
private String lastName;
private String password;
private String department;
private int mailboxCapacity;
private String alternateEmail;
//The Blueprint - Template
// Add constructor for first and last name
// Ask for department]
// Generate random password
// Set mailbox capacity
// Set the alternate email
// Change the password
//Constructor*/
public Email(String firstName,String lastName) {
this.firstName = firstName;
this.lastName = lastName;
System.out.println("EMAIL CREATED " + this.firstName + "" + this.lastName);
}
}
为什么我会搞砸我的应用程序?
解决方法
问题出在main
方法Email em1 = new email("Goanar","Rambang");
中,其中new email("Goanar","Rambang");
应该是new Email("Goanar","Rambang");