What is static method | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is static method

13th Sep 2017, 10:04 AM
YARAMATI GOPALA KRISHNA
YARAMATI GOPALA KRISHNA - avatar
2 Answers
+ 11
A static method is one type of method which doesn't need any object to be initialized for it to be called. Program execution begins from there without an object being created. consider the following example : public class Program { public static void main(String[] args) { display(); } static void display() { System.out.println("Java is my favorite programming language."); } }
13th Sep 2017, 10:29 AM
Ranjan Bagri
Ranjan Bagri - avatar
+ 5
its a static variable which you can call from main without having to create a instance of class. you have 3 variable types in class local instance static
13th Sep 2017, 10:23 AM
D_Stark
D_Stark - avatar