Hi,
I have a question regarding compilation. I am having 2 classes and one class basically uses another class. Let's say for instance we have 2 classes A and B. Now class B have something like this:
Class B
{
public void x()
{
A a= new A();
a.getSomething();
}

}

When I try to compile Class B, I get error saying cannot resolve the a.getSomething(). I am trying to do that on command line and I know I need to compile Class A and B together. I tried searching that around but I am not getting any satisfactory answers. Can anyone guide me so that I can understand the problem.

Thanks.

Recommended Answers

All 2 Replies

Can you post the full text of the error message?
Does the A class have a getSomthing() method?

Both classes need to be in the same package, OR you have to import class A at the start of B.java

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.