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 8860379
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T15:15:16+00:00 2026-06-14T15:15:16+00:00

I have a java package which contains two classes. Class A and Class B.

  • 0

I have a java package which contains two classes. Class A and Class B. I need to create an object of A type in class B. I don’t know what is happening. Please someone help me out.

package pack;

class A

class B

I’m using JDK1.5 and tomcat and placed them in java folder in my D drive.

D:\java\jdk1.5

D:\java\tomcat

Right now, my package folder is also in above location

D:\java\pack

Below is how i am compiling my java class files.

Step 1: Compiling A.java

D:\Java\pack>set path=D:\java\jdk1.5\bin (setting up path for jdk1.5 compiler)

D:\Java\pack>javac A.java (Successfuly compiled and formed A.class)

Step 1: Compiling B.java

D:\Java\pack>javac B.java (here, i get an error message )

Below is the ERROR message

Error Message

D:\Java\pack>javac B.java

B.java:9: cannot find symbol

symbol : class A

location: class pack.B

            A a = new A();    //creating an object of A type
            ^

B.java:9: cannot find symbol

symbol : class A

location: class pack.B

            A a = new A();      //creating an object of A type
                      ^

2 errors

  • 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-14T15:15:17+00:00Added an answer on June 14, 2026 at 3:15 pm
    javac pack\A.java pack\B.java
    

    will do the trick. The compiler has to be able to resolve everything in one invocation. If it’s looking for

    pack.B
    

    then that corresponds to

    pack\B.java
    

    in the directory structure

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a java package which contains all my test case classes. Each class
I have two java classes as follows App1 without a package: class App1 {
Lets say I have a java package commands which contains classes that all inherit
If I have a java class which is package-private (declared with class, not public
I have a package with logic classes(like CheckAuthenticationDataLogic.java, GetVocabulariesLogic.java). And another class - ApiService.java
I have the following simple Java code: package testj; import java.util.*; public class Query<T>
i have a domain class like package trip.side import java.text.SimpleDateFormat class HotelStay { String
I have a package for R which contains several jar files. For better maintenance
I have an app which contains a total of 10 projects: 3 java projects,
I have to parse a string which contains a formula for my java project

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.