How to print object name

Could anyone please guide me. I am passing an object to another class and then I want to print this object name in that class. when I try to print it either by giving the object in print method or after converting it with tostring and print, it always prints the object memory location but it doesn't print its name.

That memory location you're seeing is the output of the toString method defined in Object. If you want something better, override that method. Overriding toString is often (even usually, maybe always) a good thing to do.
You have to define what "name" means though. You can't print the name of the variable that points to an object, because many variables can and that kind of information is often compiled away anyway. Furthermore, information about an object should be encapsulated within the object, generally.
So the most typical and probably best approach is to create a "name" attribute in the object.

Similar Messages

  • How to find Object name for a object?

    Hi Experts,
    How to find Object name for a particular Object? Is there a Tcode for it?
    __Like Object name for__
    Material number -  materialnr
    Goods receipts / return - matbeleg
    Accounting documents -  rf_beleg
    How to find Object name for other Objects? Is there a particular way?
    Thanks & Regards
    Chandan

    Hi,
    You can find objects in SNRO transaction.
    In SNRO search by giving long text...
    for eg., Service .. for service entry sheet. keep the first letter in capital letter only.
    Thanks & Regards,
    Anand.

  • How to get Object Name

    hi
    i make a widget in flex for Captivate5.5, now i want to get my Object Name(widget->Animation->ObjectName) in flex , how can i get that name
    how can i get Object Name in Flex Dynamically....

    thnx Jim Leichliter for ur replay
    i'm using  http://blogs.adobe.com/captivate/2010/10/flex-based-widgets.html classes,

  • SQL tracing and TKPROF tool, how to get object name

    Hi,
    I set sql_trace = ture for my session.
    Then I use TKPROF (on trace file) to get the explain plan (for my stored procedure). but the explain plan shows obj# (object number), HOW do I get TKPROF to show object name on explain plan (I have checked the SYBEX book, it has no info on that)?
    Also can you get explain plan from SQL (without sql_trace) for stored procs, if so HOW?
    Thanks

    SELECT
    SERVERPROPERTY('MachineName') AS [ServerName],
    SERVERPROPERTY('ServerName') AS [ServerInstanceName],
    SERVERPROPERTY('InstanceName') AS [Instance],
    SERVERPROPERTY('Edition') AS [Edition],
    SERVERPROPERTY('ProductVersion') AS [ProductVersion],
    Left(@@Version, Charindex('-', @@version) - 2) As VersionName
     |
    Blog: MSBICOE.com |
    MCITP - BI, SQL Developer & DBA
    Hate to mislead others, if I'm wrong slap me. Thanks!

  • [jpublisher] how to change object names

    Hi all,
    please, i really need your help to solve this one...
    i'm working with jpublisher and it's working perfectly... but i need to change the objects name that are created by jpublisher. how can i do this?? have any idea???
    thanks in advance

    Hi,
    As per you we assume that this object is master data object for text : 0PROJECT_TEXT
    If you define as a Data target you need to load the data from PSA(Data source to Data target) , Here transfermations will come into the picture ( in BI 7.0)
    if you are going to load the data in 3.5 flow , transfer rules will come into the picture.
    If It is Update rules/ Transfermations try to make it active manually ..
    1. Go to RSA1 >>> And find the Data Target >>> Double click on Update Rules
    2. Click on Change button, then activate the Update rules.
    If it is transfer rules , try make it active by using this program
    in SE38 ; RS_TRANSTRU_ACTIVATE_ALL >> Give the source system name >>>>> Info source name to activate the transfer rules as well as transfer structure.
    It may help you
    Regards.
    Rambabu

  • Print object name

    Hi all,
    I am new to Java learning, I would like to print the object name in below program.
    Output should look like
    bike1 Cadence :40 speed :12 Gear :1
    bike2 Cadence :50 speed :60 Gear :2
    What are the changes I need to do to get the desired output.
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    package abbhilash;
    * @author admin
    class Bicycle {
        int cadence = 0;
        int speed   = 0;
        int gear    = 1;
        void changeCadence(int newValue)
            cadence = newValue;
        void changeGear(int newValue)
            gear =newValue;
         void increaseSpeed(int increment)
            speed = speed + increment;
          void decreaseSpeed(int decrement)
            speed = speed - decrement;
          void printStatus()
              System.out.println("Cadence :" + cadence + " speed :" + speed
                      + " Gear :" + gear);
    class BicycleDemo {
         public static void main(String[] args)
             //create two bicylce objects
             Bicycle bike1 = new Bicycle();
             Bicycle bike2 = new Bicycle();
             bike1.changeCadence(40);
             bike1.changeGear(1);
             bike1.increaseSpeed(12);
             bike1.printStatus();     
             bike2.changeCadence(50);
             bike2.changeGear(2);
             bike2.increaseSpeed(60);
             bike2.printStatus();
    }Thanks
    Raghu

    Hi Raghu,
    Here you already have the object, so you have the object name as well. All you need is to print the name. So you can pass the name of object as parameter to printStatus() method and you are done. Code changes are below:
    void printStatus(String name)// here String parameter is added
              System.out.println(name + " Cadence :" + cadence + " speed :" + speed
                      + " Gear :" + gear);
          }And inside the main method call the printStatus() method with object name.
    bike2.printStatus("bike1 ");      // calling with the name of object
    bike2.printStatus("bike2 ");Amit

  • How to hide object name in tray of pages

    Hi everybody,
    I want to hide the object name in the tray of a page.
    I act as follows: open Page in VC --> Configure Page --> Look & Feel --> unselct "Show Object name in Tray"
    I thought that is the right way, but every time I want to deploy, the option is true again.
    Could anybody help me?

    Hi Robert,
    Unfortunately, evrytime you open the model, it shows default values for the fieds. The only field for which it shows the correct value in the dashboard is 'Show Help Option'. However, at runtime, it does reflect the changes you make. You can check that in PCD.
    e.g. If you uncheck the checkbox for 'Show object name' and deploy the first time. The page should reflect the change on the Portal in PCD, however in the model shows the default value i.e. the checked checkbox. If you deploy it again, it won't change the value on the portal. It will still retain the value(unchecked,) on the portal. In order to change the value back to what it was (checked) originally, you have to uncehck the checkbox and check it again and then deploy. The values will change on the portal.
    I don't know the reason behind this behaviour though.
    Regards,
    Ajay

  • How to print the name of the layout

    Hi to all experts!
    There is a way to print in any coommercial document (A/P Invoive, A/R Invoice, Delivery notes and so on...) the name of the layout printed??
    And there is a way for the layout created for some query, to print the name of the layout and the name of the query?
    Thank's in advance...
    Edited by: Gianluca Calloni on Nov 6, 2009 9:33 AM
    Edited by: Gianluca Calloni on Nov 6, 2009 9:35 AM

    >
    Madhan Babu C wrote:
    > IF u need to print the PLD Name in Print. Try this,
    > ->> Open the Require System PLD and Save as the New PLD.
    > ->> Create 1 Database Field in Footer and assign the field.
    >
    > Table - RDOC
    > Column - CardName.
    >
    >.
    Ok.. But when i put a databasefiled in pld, i don't have the RDOC table....
    Madhan Babu C wrote:
    > ->> Create 1 TEXT field in Footer on PLD and HardCode the PLD Name.
    > Regards,
    > Madhan.
    Yes.. I think is the only solution...

  • How to print Field name with value of a Class object?

    hi, In C#, I need to print a class field or property name with value without using reflection or string.join method.
    For eg.
    protected void Button1_Click(object sender, EventArgs e)
    List<EmployeeInfo> obj = new List<EmployeeInfo>();
    obj.Add(new EmployeeInfo { eid = 123 });
    obj.Add(new EmployeeInfo { ename = "abc" });
    Response.Write(obj.ToString()); // output must be => ename ="abc" , eid = 123
    public class EmployeeInfo
    public string ename;
    public int eid;
    It need to be resulted as follows automatically with property name and value :
    ename ="abc" , eid = 123
    It need to be resulted with good performance and simple way.

    You could override ToString method in EmployeeInfo class:
    public class EmployeeInfo
    public string ename;
    public int eid;
    public override string ToString()
    return string.Format("ename =\"{0}\" , eid = \"{1}\"", ename, eid);
    protected void Button1_Click(object sender, EventArgs e)
    EmployeeInfo obj = new EmployeeInfo() { eid = 111, ename = "aaa" };
    Response.Write(obj.ToString());

  • How to print file name and date on document

    How can we print the file name and date, like in the old days, on a document as a header or footer?

    Not the print dialog for iWork but in the app itself. Here is Pages:
    Regards,
    Colin R.

  • How to print the name of layout description on standard report ?

    Dear all,
    I have saved a user specific layout.
    When i see the print preview system shows the name of standard transaction as report name,whereas i want to print and view the name of layout as report heading(name).
    Can it be possible?
    If yes plz give us the valuable inputs.
    Thanks in advance.
    Regards,
    Vikram Chavan.

    Hi,
    In your report program, use FM "GET_PRINT_PARAMETERS" and use the field PRI_PARAMS-PAART. This will have the req. value.
    else
    use sy-PLAYO field to dispaly the layout name.
    Best regards,
    Prashant

  • How to print product names and quantities

    I need to print all of the products from a stock manager application with stock levels below a given value. This is the signature I've been given:
         public void printInventoryExceptions(int quantity) Note: Not all products should be displayed, only products that are equal or below the quantity specified. Print page headings even if there are no inventory exceptions.
    Here is the full code I have so far for the application:
    public class StockManager
        private Product[] stock;
        public StockManager(int maxID)
            stock = new Product[maxID];
        public Product findProduct(int id)
            return(stock[id]);
        public Product findProduct(String name)
            int maxID = stock.length;
            boolean notFound = true;
            Product temp = null;
            for (int i = 0; i < maxID && notFound; i++) {
                if ((stock[i] != null) && (stock.getName() == name)) {
    notFound = false;
    temp = stock[i];
    return(temp);
    public int numberInStock(int id)
    int quantity = 0;
    if (stock[id] != null) {
    quantity = stock[id].getQuantity();
    return(quantity);
    public void printProductDetails()
    for (int i=0; i < stock.length; i++) {
    if (stock[i] != null) {
    System.out.println(stock[i]);
    public void addProduct(Product item)
    if (stock[item.getID()] == null){
    stock[item.getID()] = item;
    public void delivery(int id, int amount)
    if (stock[id] != null) {
    stock[id].increaseQuantity(amount);
    public Product removeProduct(int id)
    Product temp = stock[id];
    stock[id] = null;
    return(temp);
    } Any help would be much appreciated.
    Edited by: trojansc82 on Oct 25, 2008 11:20 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    Here is my whole code for the StockManager class:
    public class StockManager
        private Product[] stock;
        public StockManager(int maxID)
            stock = new Product[maxID];
        public Product findProduct(int id)
            return(stock[id]);
        public Product findProduct(String name)
            int maxID = stock.length;
            boolean notFound = true;
            Product temp = null;
            for (int i = 0; i < maxID && notFound; i++) {
                if ((stock[i] != null) && (stock.getName() == name)) {
    notFound = false;
    temp = stock[i];
    return(temp);
    public int numberInStock(int id)
    int quantity = 0;
    if (stock[id] != null) {
    quantity = stock[id].getQuantity();
    return(quantity);
    public void printProductDetails()
    for (int i=0; i < stock.length; i++) {
    if (stock[i] != null) {
    System.out.println(stock[i]);
    public void addProduct(Product item)
    if (stock[item.getID()] == null){
    stock[item.getID()] = item;
    public void delivery(int id, int amount)
    if (stock[id] != null) {
    stock[id].increaseQuantity(amount);
    public Product removeProduct(int id)
    Product temp = stock[id];
    stock[id] = null;
    return(temp);
    public void printInventoryExceptions(int quantity)
    for (int i=0; i < stock.length; i++) {
    if (stock[i] != null) {
    System.out.println("# Product : " + stock[i].getQuantity());
    }I am expecting the printInventoryExceptions to print out the product name and quanity of all products with stock levels below a given value.
    I'm able to enter an integer, but after that nothing is printed out.
    Does this need to be changed to a while loop?
    Edited by: trojansc82 on Oct 25, 2008 1:37 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How to print object list (LG01) when operations have status created.

    Hello all,
    I would like to print operations (output LG01), but if their status is created (CRTD), they are not printed. I have to change the status if I want to print them.
    Is there something in the customizing I can set, to print all the operations whatever the status ?
    Many thanks for your answers,
    Giuseppe.

    Hi,
    Check in the operation control key whether this operation is defined for Print or not.(OP67).
    This definition of print works only if CB85 is defined.
    Thanks,
    nandha

  • How to print the report file name and path and the last mod date

    Good morning,
    I am trying to print on the footer of the report the report file name and path as well as the report last modification date.
    Anyone would know how I can do that? I have checked the doc but found nothing.
    Thks. Philippe.

    Did you ever determine how to print report name and report last mod date?
    Thanks

  • It is possible to print any name 200 times without using loops?

    How to print any name 200 times without using loops and recurssive function and that to in java?

    String name = "incognito10";
    System.out.println(name.replaceAll("\\w+",
        "$0\n$0\n$0\n$0\n$0\n$0\n$0\n$0\n$0\n$0\n$0\n$0\n$0\n$0\n$0\n$0\n$0\n$0\n"+
        "$0\n$0\n$0\n$0\n$0\n$0\n$0\n$0\n$0\n$0\n$0\n$0\n$0\n$0\n$0\n$0\n$0\n$0\n"+
        "$0\n$0\n$0\n$0\n$0\n$0\n$0\n$0\n$0\n$0\n$0\n$0\n$0\n$0\n$0\n$0\n$0\n$0\n"+
        "$0\n$0\n$0\n$0\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\n$0\n$0\n$0\n$0\n$0\n$0\n$0\n$0\n"+
        "$0\n$0\n$0\n$0\n$0\n$0\n$0\n$0\n$0\n$0\n$0\n$0\n$0\n$0\n$0\n$0\n$0\n$0\n"+
        "$0\n$0\n$0\n$0\n$0\n$0\n$0\n$0\n$0\n$0\n$0\n$0\n$0\n$0\n$0\n$0\n$0\n$0\n"+
        "$0\n$0\n$0\n$0\n$0\n$0\n$0\n$0\n$0\n$0\n$0\n$0\n$0\n$0\n$0\n$0\n$0\n$0"
    );

Maybe you are looking for