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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T15:55:45+00:00 2026-06-07T15:55:45+00:00

I was looking into the String.java source code when I found that one of

  • 0

I was looking into the String.java source code when I found that one of the constructor has “String” object as parameter. This seems simple but I am not able to digest it.
For example:

public class Example {

    private String value;

    public Example() {
        // TODO Auto-generated constructor stub
    }

    public Example(Example e){
        value = e.getValue();
    }

    String getValue() {
        return value;
    }
}

While compiling class Example for the first time, the compiler would encounter the second constructor with ‘Example’ class object as parameter. At this point, how will it find it as it is still compiling this class?

  • 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-07T15:55:47+00:00Added an answer on June 7, 2026 at 3:55 pm

    When the class is compiled, all it needs access to is the declaration of the class, not the full implementation.


    Put differently, when compiling the constructor

    public Example(Example e) {
        value = e.getValue();
    }
    

    all it needs to know is that there exists a class named Example and that it has a method getValue. This information can be gathered in a separate pass over the source files, prior to actually trying to compile the code.

    (Btw, a constructor doesn’t work much differently from a method. At first glance it may seem like a constructor needs to be compiled before any method is compiled, but that reasoning mixes up compile-time issues with run-time issues.)

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

Sidebar

Related Questions

I am currently looking into spliting a very long string that could contain HTML
Greetings, I'm looking for a way to encode a string into HTML that uses
I am looking for a algorithm that takes a string and splits it into
I'm looking at some open source Java projects to get into Java and notice
This is something that has popped up our organization and I am looking for
how to convert hex string into base64 ? I found this page http://home2.paulschou.net/tools/xlate/ but
I've been looking into Java reflections. This is an example from Wikipedia http://en.wikipedia.org/wiki/Reflection_(computer_programming ):
I have this string that I generate in JAVA and pass to javascript to
I'm looking for an easy way to turn this string: (java || javascript) &&
I'm looking for a method of turning a NSMutableArray into a string. Is there

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.