NBEANS找不到或加载Main类
您好,好日子,这是第一个面向对象的类,我抛出了这个错误?我该如何修复?谢谢。 错误 ------------------------------------------------------------------------------- ------------------
--- exec-maven-plugin:3.0.0:exec (default-cli) @ Suma2 --- 错误:找不到或加载主类Com.mycompany.suma2.suma.sumamain 引起的: 命令执行失败。
有两个代码,这是
package com.mycompany.suma2.suma;
public class SumaMain {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Give me the first value ");
int valueOne=sc.nextInt();
System.out.println("Give me the first value");
int valueTwo = sc.nextInt() ;
Sum values = new Sum(valueOne, valueTwo){
values.Print();
}
}
另一个代码
public class Sum {
private int vOne, vTwo, Result ;
public Sum (int valueOne , int valueTwo ) {
this.vOne = valueOne ;
this.VTwo = valueTwo ;
}
public void Operation(){
Result = vOne +vTwo ;
}
public void Print(){
Operation();
System.out.println("The result of the sum is : + Result ");
}
}
Hello good day this is the first object oriented class, and I throw this error? How do I fix it? Thank you.
ERROR
--------------------------------[ jar ]---------------------------------
--- exec-maven-plugin:3.0.0:exec (default-cli) @ Suma2 ---
Error: Could not find or load main class com.mycompany.suma2.suma.SumaMain
Caused by: java.lang.ClassNotFoundException: com.mycompany.suma2.suma.SumaMain
Command execution failed.
There are two codes, here is one
package com.mycompany.suma2.suma;
public class SumaMain {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Give me the first value ");
int valueOne=sc.nextInt();
System.out.println("Give me the first value");
int valueTwo = sc.nextInt() ;
Sum values = new Sum(valueOne, valueTwo){
values.Print();
}
}
Here the other
public class Sum {
private int vOne, vTwo, Result ;
public Sum (int valueOne , int valueTwo ) {
this.vOne = valueOne ;
this.VTwo = valueTwo ;
}
public void Operation(){
Result = vOne +vTwo ;
}
public void Print(){
Operation();
System.out.println("The result of the sum is : + Result ");
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论