How do you use, call, and access a static method in Java?

Answer Posted / glibwaresoftsolutions

• The static keyword needs to appear before the method name.
• Use the class (className.methodName) to invoke a static method.
• No non-static instance variables or methods can be accessed by static methods.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Difference between this() and super() in java ?

813


What state is a thread in when it is executing?

730


When will we prefer to use set and list in java and why?

713


What are predefined functions?

802


What is the meaning of variable in research?

774


What data type is a string?

725


Is age a discrete variable?

734


What does main method?

778


How do you reverse a string in java?

847


What is initial size of arraylist in java?

782


What do you mean by stream pipelining in java 8?

960


Why declare Main() inside the class in java ?

801


What is variable argument in java?

771


Does printwriter create a file?

743


How can we create objects if we make the constructor private ?

743