Nbeans cant find or load main class

125 views Asked by At

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 ");
     
    }
}
0

There are 0 answers