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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T02:47:52+00:00 2026-06-17T02:47:52+00:00

Learning java newly. Can anybody clear my doubt in following? My demo application has

  • 0

Learning java newly. Can anybody clear my doubt in following?

My demo application has code like this

SourcePackages —> ex1.pkg1
|
—>food

  1. My ex1.pkg1 has one class called Ex11 and it contains the main function.
  2. My food package contains one abstract class fruit and another subclass of class fruit as Apple.
  3. I am creating an instance of Apple class in my main function in class Ex11.

The code compiles fine and runs also fine. But I am trying to understand the directory structure in java.

When I run the program I can see the following folders inside the build/class directory

  1. ex1 -> pkg1 -> Ex11.class
  2. food -> Apple.class and fruit.class
  3. fruit -> empty

I don’t understood why the directory fruit is created although I don’t have any package named fruit? Even if I delete it and compile again its not created. But created when I run the application.

Extra Info – I am using netbean IDE

  • 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-17T02:47:53+00:00Added an answer on June 17, 2026 at 2:47 am

    To answer your question Not exactly. You can create same directory structures ( hence same package) in different locations and even in different jars. For example; you can have directories CoreDomain\com\example and CoreServices\com\example. Now, classes within these two directories will have same package com.example even though they are in different directories ( but same directory with ref. to starting point ; as both are in com.example )

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

Sidebar

Related Questions

I am learning java. I wrote the following code but I am getting this
I'm learning Java on my own; and therefore the code below has no function
I'm learning java. I was trying to run the code, where I got this
I am learning Java and I would like to know how you can print
I'm learning Java, and the book I'm reading has the following example on cloning.
I am currently learning Java on my own, and this question has been puzzling
While learning Java I stumble upon this error quite often. It goes like this:
As a way of learning Java, I'm writing this little application for grade schoolers
I am learning Java and have been given these options: How can you implement
I am learning java, and studying the following example from sun.com. import java.io.*; import

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.