Reputation: 3
I am new in using eclipse java using multiple .java
files. My eclipse java project consist of one project file two package files, each with one .java
class
My 2nd java class import the 1st java class/package, like so
package VerifyLogin;
import ArgumentCountException;
// ...
The problem is VerifyLogin.java
is getting an error
Import ArgumentCountException cannot be resolved
Or any reference I have to ArgumentCountException
cannot be resolved to a type.
Upvotes: 0
Views: 1856
Reputation: 16354
When importing your class, it should be done as below:
//Current package name for the VerifyLogin Class (All package names should be lowercase by convention)
package packageforcurrentclass;
//Import statements: import thedependencyclasspackage.thedependencyclassname
import exceptionpackage.ArgumentCountException;
public class VerifyLogin
{
...
}
Upvotes: 0
Reputation: 8657
In java if you need to import a class then you need to use the full qualified name for that class, as the following:
import packageName.YourClass;
For Example, if your need to use Scanner
class, then you need to import it as:
import java.util.Scanner;
But if the class was withing the same package, you don't need to import it.
Upvotes: 2