Method Parameters in Java


Methods can take parameters, allowing you to pass data into methods.

Source Code

public static void greet(String name) {
    System.out.println("Hello, " + name);
}
public static void main(String[] args) {
    greet("John");
}
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments