Java Method Example
Chapter:
Java Basics
Last Updated:
08-08-2016 19:03:48 UTC
Program:
/* ............... START ............... */
public class JavaMethodCallingExample {
public static void main(String[] args) {
JavaMethodCallingExample method = new JavaMethodCallingExample();
method.welcomeToJava();
}
public void welcomeToJava() {
System.out.println("Hello To Java Programming");
}
}
/* ............... END ............... */
Output
Welcome To Java Programming
Notes:
-
A Java method is a collection of statements that are grouped together to perform an operation.
- A method is a set of code which is referred to by name and can be called (invoked) at any point in a program simply by utilizing the method's name. Think of a method as a subprogram that acts on data and often returns a value.
Tags
Method Example, Java