how to call a method in different package?

Answer Posted / taresh nama

You Must import the package with fully Qualified name of
the class contains method.
Now you can call a method as:classname.method();
You can create a new object to that class and then call the
method as objectname.method();

Is This Answer Correct ?    3 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is difference between protected and private?

524


Why does the integer quotient -0/3 yield 0, but the double quotient -0.0/3.0 yields – 0.0?

601


How do we access static members in java?

624


What is bufferedwriter?

540


Is java call by value?

581






Can a class declared as private be accessed outside it’s package?

508


Explain restrictions on using enum?

626


What causes memory leaks in java?

490


What is the difference between JVM and JRE?

616


Explain the difference between collection api and stream api in java8?

503


What package is math in java?

530


What are parameters in a method?

581


Explain the difference between transient and volatile in java?

571


Tell us something about different types of casting?

517


What is a boolean field?

523