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

Why parsing is done?

0 Answers  


How do you remove an element from an arraylist in java?

0 Answers  


What is substring 1 in java?

0 Answers  


What are the basic concepts of OOPS in java?

0 Answers   Axtria, ITC Indian Tobacco Company,


What is difference between fileinputstream and filereader in java?

0 Answers  






What is native code?

0 Answers  


How infinite loop is declared?

0 Answers  


What is array length in java?

0 Answers  


Can anonymous class have constructor?

0 Answers  


Can we override singleton class?

0 Answers  


what is features of jdk 1.5?

2 Answers   Accenture, Satyam, TCS,


Is it safe for adding 10,00,000 records/objects to HashMap?, i.e is it safe to add millions of objects to HashMap?

2 Answers  


Categories