0

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 ");
     
    }
}
Bruno
  • 1
  • Does this answer your question? [how to set default main class in java?](https://stackoverflow.com/questions/1635136/how-to-set-default-main-class-in-java) specifically see this answer https://stackoverflow.com/a/5534598 or https://stackoverflow.com/a/29860099 – sorifiend Apr 12 '22 at 01:25
  • Show us your maven pom.xml file and folder structure. – Alex Apr 14 '22 at 12:02

0 Answers0