Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8998147
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:59:06+00:00 2026-06-15T23:59:06+00:00

Just want to confirm if Salesforce Apex don’t support parameters like Java and other

  • 0

Just want to confirm if Salesforce Apex don’t support parameters like Java and other languages?

For example:

It’s a simple function with parameters in Java. And, Salesforce Apex DO NOT support such kind of syntax. Am I right?

public int mult(int x, int y)
{
   return x * y;
}

Salesforce can pass parameters from Javascript or Visualforce Page to Apex, however, I never see parameters within function/class in Apex language so just want to make sure it. If Salesforce have function and parameters then we can write apex code more with efficient structure.

Added by 2012-12-18 ===========================
Thanks Gerard Sexton, it works.

Sample codes:

public class MyClass {
    public integer mult(integer x, integer y)
    {
        return x * y;
    }
}

MyClass m = new MyClass();

System.debug(m.mult(3,4));

The result is 12.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T23:59:06+00:00Added an answer on June 15, 2026 at 11:59 pm

    Apex does support method parameters.

    Here are the docs for defining a class method.

    public class MyClass {
        public static integer mult(integer x, integer y)
        {
            return x * y;
        }
    }
    

    These methods can be accessed and used ONLY within APEX. To use data passed in from a Visualforce page, please see these docs for an example.

    In the visualforce example they use searchText as a class instance property, but in standard programming languages we would pass it in as a method parameter.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just want to confirm that I have this correct, and would like to see
I just want to confirm my understanding of a few fundamentals. Hope you don't
I just want to confirm something I noticed when downloading a file through sftp
I just want to confirm my understanding of exceptions and how they impact their
I didn't find it on their doc http://www.sqlite.org/lang_corefunc.html So just want to get confirm
Just getting up to speed with YAML and want to confirm whether it's possible
I just want to confirm that I'm understanding correctly, in Interface Builder the Class
For those who code in Notepad++, I just want to confirm that Notepad++ does
Just want to confirm with the COM/DCOM experts out there... I have a Delphi
I just want to confirm what I've understood about Generics in C#. This has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.