cancel
Showing results for 
Search instead for 
Did you mean: 

How to call a Java class from another java class ??

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

snehal_kendre
Active Contributor
0 Kudos

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()

}

Answers (0)