Eclipse – 编译问题

huangapple go评论92阅读模式
英文:

Eclipse - Comp Issues

问题

以下是已翻译的部分:

所以我正在尝试在Eclipse上构建一个电子邮件管理应用程序,但我遇到了一个问题。控制台显示:

  1. 异常线程“mainjava.lang.Error:未解析的编译问题:无法将电子邮件解析为类型
  2. emailapp.EmailApp.main(EmailApp.java:6)

以下是我在两个类中已经编写的代码:

  1. package emailapp;
  2. public class EmailApp {
  3. public static void main(String[] args) {
  4. Email em1 = new Email("Goanar", "Rambang");
  5. }
  6. }
  1. package emailapp;
  2. public class Email {
  3. private String firstName;
  4. private String lastName;
  5. private String password;
  6. private String department;
  7. private int mailboxCapacity;
  8. private String alternateEmail;
  9. //蓝图-模板
  10. //为名字添加构造函数
  11. //询问部门
  12. //生成随机密码
  13. //设置邮箱容量
  14. //设置备用电子邮件
  15. //更改密码
  16. //构造函数
  17. public Email(String firstName, String lastName) {
  18. this.firstName = firstName;
  19. this.lastName = lastName;
  20. System.out.println("已创建电子邮件:" + this.firstName + " " + this.lastName);
  21. }
  22. }

有没有可能是我弄乱了我的应用程序的原因?

英文:

So I am trying to build a Email Admini App on Eclipse but there is a issue that I am
having. The console says:

  1. Exception in thread "main" java.lang.Error: Unresolved compilation problem:
  2. email cannot be resolved to a type
  3. at emailapp.EmailApp.main(EmailApp.java:6)

Here is my code that I have written already in my 2 classes:

package emailapp;

public class EmailApp {

  1. public static void main(String[] args) {
  2. Email em1 = new email("Goanar","Rambang");
  3. }

}

  1. public class Email {
  2. private String firstName;
  3. private String lastName;
  4. private String password;
  5. private String department;
  6. private int mailboxCapacity;
  7. private String alternateEmail;
  8. //The Blueprint - Template
  9. // Add constructor for first and last name
  10. // Ask for department]
  11. // Generate random password
  12. // Set mailbox capacity
  13. // Set the alternate email
  14. // Change the password
  15. //Constructor*/
  16. public Email(String firstName, String lastName) {
  17. this.firstName = firstName;
  18. this.lastName = lastName;
  19. System.out.println("EMAIL CREATED " + this.firstName + "" + this.lastName);
  20. }
  21. }

Any reasons why I may be screwing up my app?

答案1

得分: 0

问题出在 main 方法中,Email em1 = new email("Goanar","Rambang");,其中 new email("Goanar","Rambang"); 应该改为 new Email("Goanar","Rambang");

英文:

The problem is in the main method, Email em1 = new email("Goanar","Rambang"); where new email("Goanar","Rambang"); should be new Email("Goanar","Rambang");

huangapple
  • 本文由 发表于 2020年8月23日 07:29:46
  • 转载请务必保留本文链接:https://go.coder-hub.com/63542039.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定