Method Parameters
Learn how to pass information into Java methods using parameters.
Java Code
Study the example and understand what each part does.
public class Main {
static void greet(String name) {
System.out.println("Hello " + name);
}
public static void main(String[] args) {
greet("Vincent");
greet("Mary");
}
}
Java code normally runs using the Java Development Kit on a computer, Android Studio or another Java development environment. This course page presents the code examples without pretending that the browser is running Java directly.
Expected Output / Result
Hello Vincent Hello Mary
Finished this lesson?
Mark it complete to update your course progress.