P R 3 A C H 3 R
P R 3 A C H 3 R

Reputation: 55

How to import class in package to another package?

ex:I want to define a class A in a package called ABC and import the class A in the package ABC to another package which has a class X?

Upvotes: 0

Views: 7659

Answers (2)

supadopecat
supadopecat

Reputation: 11

I have not touched java in a while and I am not too familiar with it. Since no one else has commented yet, here is my 2 cents

In python importing from another class... you declare:

{filename}.{classname}.{thenthemoduleyouwanttouse()}

I would assume the same concept in java. Find a way to use object oriented programming.

Upvotes: 1

Nyakiba
Nyakiba

Reputation: 862

Simply declare at the top of your class:

import ABC.A

and you can now use the public methods and attributes of class A

Upvotes: 1

Related Questions