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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:02:02+00:00 2026-05-27T09:02:02+00:00

I have the A class in the a package. After I have the B

  • 0

I have the A class in the a package.

After I have the B class in the a.b package. B contains the method m().

I want to call m() inside and only inside class A. Precisely I don’t want to set m() to be public.

Is it possible?

Sorry for the title. I’ve not found anything better.

Edit for clarify: A and B classes have to be used by a developer (they form an API) and inside A I have a private method that compute something that modify the B object, but this cannot be called by the developer. There is any other relation between the a and a.b packages in addition to the fact that their corresponding folders are one inside the other?

Edit2: class A contains a List<B>. A is the class that has to talk with the server, which responses with a value. A has to insert this value in every element in the list.

  • 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-05-27T09:02:02+00:00Added an answer on May 27, 2026 at 9:02 am

    Unless A subclasses B (and I wouldn’t do that just for the sake of inheritance), there’s basically no “special” relationship between A and B, so there’s no way of doing this, I’m afraid.

    What exactly do you need to protect against here? Is it just a matter of not trusting yourself or your colleagues not to call the method at the right time, or something stronger? You could potentially check the stack at execution time, although that’s dangerous in terms of inlining etc potentially messing things up – and it would only be at execution time.

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

Sidebar

Related Questions

If I have a java class which is package-private (declared with class, not public
I have the similar problem as Android Facebook.authorize don't call oncomplete method onComplete method
I have class A which extends the Activity class. This class is in package
I'm using the NetBeans IDE(6.8). I have a DB class : package garits; import
VB.NET .NET 3.5 I have an aggregate class called Package as part of a
I have a base class like this: package MyClass; use vars qw/$ME list of
I have a class named as order in package com.abc I have another class
I have next package structure webService.ear -- dependency.jar -- some.class Can I remove some.class
I have written an Apex class in a Salesforce managed package which uses the
I have a package with a few modules, each module has a class (or

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.