I created 5 separate programs, and put them in the same folder; each one of them has a package. I need to create another one that calls their methods. The incomplete code that I have so far is:

import edu.macomb.itcs2590.babylonlion .cars.*;
import edu.macomb.itcs2590.babylonlion .trucks.*;

public class InventoryApp
{	
	public static void main(String[] args)
	{
		

	}
}

please help me with this

Recommended Answers

All 3 Replies

Each package has it's own directory (in the normal state of affairs, there are other ways of doing it, but we won't get into those).

I.E. Hypothetical, your source code is under
/my/source
and your compiled code is under
/my/classes
then for the package
thisIs.myPackage
and the class
DontYouLikeIt
the java file should be located at
/my/source/thisIs/myPackage/DontYouLikeIt.java
and the class file should be located at
/my/classes/thisIs/myPackage/DontYouLikeIt.class

So, hopefully those "5 programs" all have the same package and not just "a pacakge".

Now, what exactly, is your problem?

Because you have imported the packages, you can just call any of the public methods in those packages. Try it!

Hi there,
First off all, I appreciate the help. I was actually able to fix the problem.

Thank you guys :)

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.