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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T01:12:03+00:00 2026-05-16T01:12:03+00:00

Just curious about how jaxb works, I have a class annotated as follows: @XmlRootElement(name

  • 0

Just curious about how jaxb works, I have a class annotated as follows:

@XmlRootElement(name = "MyJaxb")
Class MyJaxb
{
      @XmlElement
      protected String str;

      public void setStr(String str)
      {
           this.str = str;
      }
 }

The access modifier of field str is protected, why Jaxb can still marshall and unmarshall it?

  • 1 1 Answer
  • 1 View
  • 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-16T01:12:03+00:00Added an answer on May 16, 2026 at 1:12 am

    It uses reflection. A protected or private field or method can be accessed using the reflection API (using setAccessible(true) on the appropriate Field or Method object).

    Remember – public, protected and private are controls on default visibility, nothing more. They do not (and cannot) prevent access using reflection.

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

Sidebar

Related Questions

Just curious about a particular scenario of NAT. Let's suppose we have 4 computers
Just curious about SQL syntax. So if I have SELECT itemName as ItemName, substring(itemName,
I'm just curious about whether or not I have to call this on the
I'm just curious about Domain-Specific Languages. I have seen them several times in articles,
I am just curious about the title. String a = abc\ndef; Console.Writeline(a); The output
So I'm just curious about this: DataMapper uses a mixin for its Models class
I was just curious about the subject. I have never used aspect oriented programming
I'm just curious about which among variables and methods inside a class were initialized
Just curious about the encodings that system is using when handling string storing(if it
I'm just curious about how Java actually works when it come to if statements.

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.