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

What are user defined exceptions?

0 Answers  


What is the ResourceBundle?

2 Answers   Elementus Technologies,


Differences between C and Java?

0 Answers   TCS,


Write a code to create a trigger to call a stored procedure

0 Answers  


What does the @override annotation do?

0 Answers  


What class is used to implement a Throwable array?

3 Answers  


What is re-factoring in software?

0 Answers  


what is the need to set path in java? how many ways to set path in java? Explain breif?

5 Answers  


What is array initialization in java?

0 Answers  


what are the purposes of native, transiant key words?

2 Answers  


What is parse method?

0 Answers  


Describe what happens when an object is created in java ?

0 Answers  


Categories