Language syntax
Java formal parameters
Declare typed input variables initialized with argument values.
Formal Syntax & Structure
java syntaxjava
static int total(int quantity, int unitPrice)Working Example
Example Snippetjava
public class Main { static int total(int quantity, int unitPrice) { return quantity * unitPrice; } public static void main(String[] args) { int cost = total(3, 7); System.out.println(cost); System.out.println(total(2, 5) + 1); }}