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

  • Home
  • SEARCH
  • 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 3425726
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T06:37:43+00:00 2026-05-18T06:37:43+00:00

package portale.interfaccia; public class PageIndex extends FlowPanel { protected Integer prova; private PageCenter center;

  • 0
package portale.interfaccia;
public class PageIndex extends FlowPanel {
    protected Integer prova;

    private PageCenter center;
    public PageIndex() {
        this.center=new PageCenter();
        this.add(center);    
    }
}

package portale.interfaccia;
public class PageCenter extends FlowPanel {
    public PageCenter() {
        super.prova=2;
    }
}

why, if prova is protected, i can’t access to it by using super?
Cheers

  • 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-18T06:37:43+00:00Added an answer on May 18, 2026 at 6:37 am

    PageCenter extends from FlowPanel, not from PageIndex. It looks like FlowPanel has no attribute named prova

    If you want PageCenter to access a protected attribute from PageIndex using the super keyword, then you should extend from PageIndex.

    public class PageCenter extends PageIndex{
    
       public PageCenter(){
          prova = 2;
       }
    }
    

    If you want both classes to extend from FlowPanel, try refactoring your code so that PageIndex and PageCenter know some utility class.

    public class ProvaUtility{
    
        private Integer prova;
    
        public Integer getProva(){}
    
        public void setProva(Integer p){}
    }
    

    Then you could use it like this:

    public class PageIndex extends FlowPanel{
    
        private ProvaUtility utility;
    
        private PageCenter center;
    
        public PageIndex(ProvaUtility pu){
    
            this.utility = pu;
            this.center = new PageCenter(pu);
            this.add(this.center);
        } 
    
        public Integer getProva(){
             return this.utility.getProva();
         }
    }
    
     public class PageCenter extends FlowPanel{
    
        private ProvaUtility utility;
    
        public PageCenter(ProvaUtility u){
           this.utility = u;
           this.utility.setProva(2);
        }
     }
    

    If passing this reference around doesn’t make it for you, try using a Singleton

    class ProvaSingleton{
    
       private static ProvaSingleton instance = null;
    
       private Integer prova;
    
       private ProvaSingleton(){
          prova = 2;
       }
    
       public static ProvaSingleton getInstance(){
    
          if (instance == null){
              instance = new ProvaSingleton();
          }
          return instance;
       }
    
       public Integer getProva(){ return this.prova;}
    
       public void setProva(Integer p){this.prova = p;}
    }
    

    Then call it by:

    ProvaInstance.getInstance().getProva()

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

Sidebar

Related Questions

I found this PECL package called threads , but there is not a release
I package our server releases into zip files using a batch file (Windows), running
I'm receiving Package Load Failure error when I open VS 2005 after I installed
I have an SSIS package, which depending on a boolean variable, should either go
What are some good package naming conventions for domain specific object models. For example,
Is there a Java package providing funcionality like the .Net System.Data namespace ? Specificaly
I'd like to package a C# windows service project so it can be easily
I tried to package a Twisted program with py2exe, but once I run the
Which Eclipse package should I choose for Python development with PyDev ? Nothing on
First thing: I know that there is interface to W3C validator: http://pear.php.net/package/Services_W3C_HTMLValidator/ But I

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.