Checkout our demo site to practice selenium https://magento.softwaretestingboard.com/

0 like 0 dislike
1.6k views
by Contributing Tester (92 points)
retagged by

Error:-

Multiple markers at this line
    - Syntax error on token ".", @ expected after this token
    - Syntax error on token ",", < expected
    - Syntax error, insert "SimpleName" to complete 
     QualifiedName
    - Syntax error, insert ")" to complete MethodDeclaration

Code:-

package BasicCalculation;

public class Add {
    public static int add(int one, int two){
        int temp = one + two;
        return temp;
    }
    
    public static void main(String []args){
        int output = Add.add(3, 3);
        int outputnew = Add.add(3, 11);
        
        System.out.println("Output = " + outputnew + " " + output );
    }
}

Calling add method defined above here--

package AdvancedCalc;
import BasicCalculation.Add;

public class Percetage {    
    
    Add.add(3,3);
}

Please help in resolving this. Using java 1.8

1 Answer

0 like 0 dislike
by The go-to Tester (181 points)
selected by
 
Best answer

The first problem you have is with your class Percentage.

You can not call any method directly inside a class.

public class Percetage {    
    public static void main(String []args){

       Add.add(3,3);

   }
   
}

Hope that helps!


This site is for software testing professionals, where you can ask all your questions and get answers from 1300+ masters of the profession. Click here to submit yours now!

1.4k questions

1.6k answers

866 comments

1.9k users

...