I am trying to understand Static methods in java. I have done a basic python before, so I am trying to visualise the Java's static method in Python.
Is the static method in the code below
class test{
public static void main(String[] args) {
printHello();
}
public static void printHello(){
System.out.println("This is a Java's static method");
}
}
equivalent to this?
def printhello():
print("It is a printhello function")
class hello():
def printhello(self):
print("It is a printhello method of a instance")
As static methods can be accessed without creation of objects, def printhello would work like this.
And when a object is accessing static method in Java, the instance method provided in the python class would work like that.
If not, what would be right visualisation of a java's static method in python.
Thanks.
JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)