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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T16:34:28+00:00 2026-06-03T16:34:28+00:00

String myString=Plz_help; I came to know that ‘myString’ is not an object but a

  • 0
String myString="Plz_help";

I came to know that ‘myString’ is not an object but a object reference variable which stores the base address of the actual object. So ‘myString’ should return an address when i execute

System.out.println(myString);

but it is returning ‘Plz_help’ to the output.

Myclass obj_ref_var=new Myclass();

When I use the same System.out.println(obj_ref_var) for other class which I had created, it is returning the address.

  • 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-03T16:34:33+00:00Added an answer on June 3, 2026 at 4:34 pm

    When you call System.out.println on an object reference, system executes toString() method defined for the actual object that this reference refers to. For String this method returns its value.

    Apparently, you haven’t defined toString() method for your class that’s why you get object classname + hashcode.

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

Sidebar

Related Questions

I am passing a string variable to a method. I know strings are reference
string myString = string.Format({0}{1}, foo); This compiles but fails at runtime. I know why,
String myString = this; //string is immutable myString.concat( that); //a new object is created
I would declare an empty String variable like this: string myString = string.Empty; Is
Which do you prefer and why String myString = null; if(someCondition) myString = something;
Just curious. If you go: string myString; Its value is null. But if you
I have program that asks to enter a string (mystring) and a char (ch).
Right now I'm using the following to minimize boxed object creation: String myString =
String.Format works fine with Debug.WriteLine if variable not of string type: int myNumber =
If I have a string variable with value as follows :- string mystring =

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.