• Vishal Singh 189
  • NEWBIE
  • 0 Points
  • Member since 2021

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies

Hi All,

I am getting error:
"Method does not exist or incorrect signature: void returnAverageSum(List<Opportunity>) from the type PracticeApex" . Kindly help me in resolving above error.

Here is my code

public class PracticeApex{
    public static void retrunAverageSum(List<Opportunity> ol){
        Integer avg=0;
        Integer sum=0;
        Integer size= ol.size();
        for(Opportunity o: ol){
           sum=sum+o.Amount.IntValue();           
        }
        avg=sum/size;
    System.debug(avg);
    }
    }

from Dev Console:

PracticeApex pa=new PracticeApex();
List<Opportunity> opp=[Select Id, Amount from Opportunity];
pa.returnAverageSum(opp);