how to call a method in different package?

Answers were Sorted based on User's Feedback



how to call a method in different package?..

Answer / sandhya.s

Import the package in to the class, where other package's
method is useful.

Is This Answer Correct ?    18 Yes 4 No

how to call a method in different package?..

Answer / venkatachalapathy

import fully Qualified name of the package in which the
method is present
use the method as "classname.methodname"
or
create the object of that package using a fullyqualifed
name of that package and use the method
as "object.methodname

Is This Answer Correct ?    12 Yes 0 No

how to call a method in different package?..

Answer / kiranksj

import package in the class.That package related methods are now accessible in a class.If u want call a method
classname.method(); or create a new object to a class and then call the method like objectname.method();

Is This Answer Correct ?    2 Yes 0 No

how to call a method in different package?..

Answer / 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

More Core Java Interview Questions

What is data object example?

0 Answers  


Can a class be private or protected in java?

0 Answers  


Explain the JDB in depth & command line.

0 Answers  


What is the use of anonymous inner classes ?

12 Answers   DELL, HCL,


I want to print “hello” even before main is executed. How will you acheive that?

0 Answers  


Can we use a switch statement with strings?

0 Answers  


what is polymorhism what is inheritance? what is Abstract n Interface? what if two interfaces have same method and a concrete class is implementing both the interfaces. Will there be a compilation error? What are mutable and immutable classes? How can u make a class mutable? when will u use dem ...explain with example? what is overriding and overloading? what is garbage collection? what is Thread? how do dey communicate? what are the different ways of implementing ? have u used any messaging technologies? what is synchronization? what are some additions in java 1.5? what are generics? whst is advanced for loop? what is finally block? can u have a try in finally? yes!! can u have a finally in finally? how do you write junits? when is a object eligible for garbage collection?explain? a = null and b has ref to a will b be eligible to be garbage collected? sql questions like diff joins? how do dey work? exception handling? what is marker interface? what is the need??

0 Answers   JPMorgan Chase,


What is the difference between a choice and a list?

0 Answers  


What is a list in java?

0 Answers  


What is the difference between class & object?

0 Answers  


Explain in detail about encapsulation with an example?

4 Answers  


What is the Dictionary class?

1 Answers  


Categories