Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8706535
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T03:38:15+00:00 2026-06-13T03:38:15+00:00

two package: a.sub.ClassA , b.ClassB ; package a and package b are at the

  • 0

two package:
a.sub.ClassA,
b.ClassB;

package a and package b are at the same level in my project.

If I want to use ClassB in ClassA, I wrote import b.* in ClassA, why does it can’t be compiled?

This is my package image:

This is my code:
bussinessLogicService/MemberBLService.java

package bussinessLogicService;
import java.util.ArrayList;
import po.*;

public interface MemberBLService {
    public String getMemberName();
    public String getMemberID();
    //some methods more
}

busssinessService/MemberService.java

package bussinessLogic.controller;

import java.util.*;
import bussinessLogicService.MemberBLService;

public class MemberBLService_Stub{


}

Here is the problem:
See,line 4 can't get compiled!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T03:38:17+00:00Added an answer on June 13, 2026 at 3:38 am

    There are a couple of reasons for why it could fail. Make sure that

    1. file ClassA.java is located in folder ./a/sub and file ClassB.java is located in folder ./b
    2. the first line in ClassA.java is package a.sub;, the first line in the other file is package b;
    3. both classes are declared as public (like: public class ClassA)
    4. the import statement is written like: import b.*; (import b.ClassB; should work too)
    5. ClassB gets compiled before ClassA (compiler needs to see ./b/ClassB.class)
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have these two modules : package G1; sub new { my $class =
In Eclipse I have two projects with the same package structure. In one of
Update for the impatient: it's simple, use package.- for sub-package scanning instead of package.*
Let's say there are two modules that mutually use each other: package a; use
JSONObject class of package org.codehaus.groovy.grails.web.json does not implement Serializable . I want to make
A very strange thing indeed. I have the following project structure: myproject/one/two Inside package
I have an SSIS Package with two steps: 1) FTP in to a server
Is it possible to create installation package of two or more installation in visual
I have two java classes as follows App1 without a package: class App1 {
I have two classes. package utilities; public class PostCaller { public String getUrl() {

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.