-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path097-Static-Method.java
More file actions
42 lines (35 loc) · 1.25 KB
/
Copy path097-Static-Method.java
File metadata and controls
42 lines (35 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/*
* ============================================================================
* Program Name : Static Method
* File Name : 097-Static-Method.java
* Class Name : StaticMethod
*
* Description:
* This program demonstrates the usage of a static method in Java.
* A static method belongs to the class rather than an object and
* can be called directly using the class name.
*
* Objective:
* - Understand the concept of static methods.
* - Learn how to declare a static method.
* - Learn how to call a static method without creating an object.
*
* Author : Shaik Mahaboob Basha
* Repository : 01-Core-Java
* Folder : 08-Java-Programs
* ============================================================================
*/
public class StaticMethod {
// Static method to display a welcome message.
public static void displayMessage() {
// Display the welcome message.
System.out.println("Welcome to Core Java Programming!");
}
// The main() method is the entry point of every Java application.
public static void main(String[] args) {
// Call the static method using the class name.
StaticMethod.displayMessage();
// Example Output:
// Welcome to Core Java Programming!
}
}