on 10-08-2008 5:35 AM
Hi ..... can somebody plz tell me
How to call a Java Class from another Java Class assuming both in the same Package??
I want to call the entire Java Class (not any specific method only........I want all the functionalities of that class)
Please provide me some slotuions!!
Waiting for some fast replies!!
Regards
Smita Mohanty
Hi Smita,
you just need to create an object of that class,thats it. Then you will be able to execute each and every method.
e.g.
you have developed A.java and B.java, both are in same package.
in implementaion of B.java
class B
{
A obj = new A();
//to access A's methods
A.method();
// to access A's variable
//either
A.variable= value.
//or
A.setvariable() or A.getvariable()
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
101 | |
13 | |
13 | |
11 | |
11 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.