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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T04:48:43+00:00 2026-06-03T04:48:43+00:00

When i was dealing with threads concept in Java, i have seen Thread.java source

  • 0

When i was dealing with threads concept in Java, i have seen Thread.java source file. I noticed when setName() method assigns string to a character array called "name[]". Java has a feature of String data type, then why they are using character array.

In source file it is initialised like,

private char name[]; // why not "private String name;"

In setName() method,

public final void setName(String name) {
    checkAccess();
    this.name = name.toCharArray();
    }

Please help me. Thanks in advance.

  • 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-03T04:48:45+00:00Added an answer on June 3, 2026 at 4:48 am

    This name is accessed from native code, so it is easier to handle char arrays than mangle with Java types. The core-lib-devs mailing list discussed this question a while ago, here’s a link to one mail from the thread. The original question stated that “a fair amount of time goes to that Thread.setName call which I believe a significant portion is to do new char allocation and copy char array etc”. Quoting bits of the answer:

    There was an RFE for this way back in late 2002:

    4745629 (thread) Thread.setName does needless string allocations
    (don’t use char[])

    The initial eval in 2002 stated:

    “I can’t imagine that this seriously impacts the performance of any
    real program. Furthermore, changing the fields in Thread is
    problematic due to the close relationship of this class with the VM.
    That said, it might be worth addressing this in the context of some
    Thread code-cleanup.”

    Then in 2005 it was closed as “will not fix”:

    “There are dependencies on the name representation being a char array
    in the JVM and this RFE must be respectfully rejected.”

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

Sidebar

Related Questions

I need some help dealing with three Threads in Android One thread is the
Well I am not familiar with threads in java, so I am dealing with
Scenario: I'm dealing with 2 viewControllers each with it's own context (same thread). I'm
Dealing with Java - which the option you prefer in the most cases -
When dealing with a single file, I'm used to: /blah do some work n
I am dealing with a race condition, I believe, in my JAVA GUI. I
I'm trying to understand how threads works. I have some examples from the school.
When dealing with threads (specifically in C++) using mutex locks and semaphores is there
There are some threads on Stack Overflow dealing with implementing priority queues in .Net
Ok, so, I have a different kind of problem when dealing with Radio button

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.