Search:

Type: Posts; User: jps

Search: Search took 0.10 seconds.

  1. Replies
    14
    Views
    1,651

    Re: protected Access Specifier

    Ya that is the same link I posted which states:
  2. Replies
    14
    Views
    1,651

    Re: protected Access Specifier

    I disagree completely. Your code compiles as is.
    ...and with an output:
    package test;

    public class A
    {
    protected String names;
    String addresses;
    }
    package test;
  3. Replies
    14
    Views
    1,651

    Re: protected Access Specifier

    Protected would not just be visible to main...
    Protected is visible to the entire class where it is declared. It is visible to the entire class of any class that extends the original class. It is...
  4. Replies
    14
    Views
    1,651

    Re: protected Access Specifier

    I think helloworld922 misunderstood. Perhaps I misunderstood. Maybe this will clear it up:
    public class A {

    protected String name;
    private String surname;
    }


    public class B extends A {
  5. Replies
    14
    Views
    1,651

    Re: protected Access Specifier

    I suggest you read about the protected keyword and see what it means to be protected. While you are there check out the other options. It will all be clear if you read that one page..
Results 1 to 5 of 5