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

  • Home
  • SEARCH
  • 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 9250583
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T10:28:36+00:00 2026-06-18T10:28:36+00:00

is it possible to get an object from his reference id? i get a

  • 0

is it possible to get an object from his reference id?

i get a list of String containing the reference id of an object like:

com.test.test.business.model.Gamma@20

how to get the object from this reference id?

it’s only a string and it isn’t castable to the object itself

  • 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-18T10:28:37+00:00Added an answer on June 18, 2026 at 10:28 am

    What you see is called the default toString of an object. It is an amalgamation of the FQCN (fully qualified class name) of the class it belongs to and the hashCode of the object.

    Quoting from the JavaDoc of toString:

    The toString method for class Object returns a string consisting of
    the name of the class of which the object is an instance, the at-sign
    character `@’, and the unsigned hexadecimal representation of the hash
    code of the object. In other words, this method returns a string equal
    to the value of:

     getClass().getName() + '@' + Integer.toHexString(hashCode())
    

    In short, you can’t get an object using this reference id.

    We can override toString to give a more human readable output. Take a look at the below two classes, with and without toString. Try to execute the main method and compare the output of the two print statements.

    class Person {
        private String name;
    
        @Override
        public String toString() {
            return "Person [name=" + this.name + "]";
        }
    }
    
    class Address {
        private String town;
    }
    
    public class Test {
        public static void main(String... args) {
            Person person = new Person();
            Address address = new Address();
    
            System.out.println("Person is : " + person);
            System.out.println("Address is : " + address);
        }
    }
    

    However, if you are really looking for a way to persist objects and resurrect them at a later stage, you should read up on Serialization.

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

Sidebar

Related Questions

Is it possible to get the raw HTTP Request from the HttpServletRequest object? I
Possible Duplicate: Python: Get object by id Typically when you see the string representation
Is it possible in JSP to get the type of Object in List, just
Is it possible to get java object attributes from javascript function. Example by using
I have a string like this: (((foo))) I would like to get an object
Possible Duplicate: How to get string Objects instead Unicode ones from JSON in Python?
Is it possible to get name of file, from object of File class? For
Is it possible to get an ImageData Object from an image which is not
is is possible to get the binded ViewModel JavaScript object from a given DOM
Is it possible to get/set instance variables of an object from inside a module

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.