function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Lukesh KarmoreLukesh Karmore 

why we use parameters in apex class

for ex-
@HttpPost
global static ID createCase(String subject, String status, String origin, String priority) {
Case thisCase = new Case(
Subject=subject, Status=status, Origin=origin, Priority=priority);
insert thisCase;
return thisCase.Id;
}
why we use this parameters like "String subject, String status, String origin"
thank you
AnudeepAnudeep (Salesforce Developers) 
In Apex framework, to define a method, you need to specify the following:

Optional: Modifiers, such as public or protected.

Required: The data type of the value returned by the method, such as String or Integer. Use void if the method does not return a value.

Required: A list of input parameters for the method, separated by commas, each preceded by its data type, and enclosed in parentheses (). If there are no parameters, use a set of empty parentheses. A method can only have 32 input parameters.

Required: The body of the method, enclosed in braces {}. All the code for the method, including any local variable declarations, is contained here.

You need to use the following syntax when defining a method:
 
[public | private | protected | global] [override] [static] data_type method_name 
(input parameters) 
{
// The body of the method
}

As you can see each input parameter is preceded by its data type

https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_defining_methods.htm

Let me know if this helps. If it does, please mark this answer as Best. It may help others in the community. Thank You!