How to call static method?

Answers were Sorted based on User's Feedback



How to call static method?..

Answer / maharajan j

Static methods we can call without class reference.We don't
need to create an object of that particular class.

For example:
class A{

static void disp(){
sysout("Java")
}
}
class B{

B(){
A.disp();
}

}

Is This Answer Correct ?    13 Yes 0 No

How to call static method?..

Answer / ravikiran

with the class name

Is This Answer Correct ?    6 Yes 1 No

How to call static method?..

Answer / ranganathkini

A static method may be called in 2 ways:

1. Thru the class reference
2. Thru the instance reference of the class

Is This Answer Correct ?    6 Yes 2 No

How to call static method?..

Answer / ravi jain

Simplest thing to remember is

ClassName.staticMetohdName();

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More Core Java Interview Questions

Do you know how to reverse string in java?

1 Answers  


How do you define a singleton class?

1 Answers  


What is the symbol for space?

1 Answers  


Can a class be protected in java?

1 Answers  


Explain static nested classes ?

1 Answers  


What is difference between local variable and global variable?

1 Answers  


how do I create a runnable with inheritance? : Java thread

1 Answers  


what is check p object in java

1 Answers   TCS,


How to sort a vector elements that contains the user define class object? (Note: If Suppose consider, A Student class contain two data members. They are String studentName and int rollNo. I am creating Four objects for this class, each object contains students details like name and roll no. Now i am storing that objects in vector and if i retiving the elements from the vector means then it should be display in sorting order)

3 Answers   ProdEx Technologies,


what is the difference between ArrayList and Vector

19 Answers   KPIT, Sasken, Satyam, Span Infotech, Wipro,


What is the difference between the synchronized() & static synchronized()?

2 Answers   HP, SparkTG,


What is local variable and instance variable?

1 Answers  


Categories