How to print out contents of an object

Hello, I am having a problem printing out the contents of an object I have created.
ListReturn test = new ListReturn("ADMNTEST", "JUL", "2002", con);
System.out.println(test);I see this:
com.home.tools.reporting.ListReturn@6cd7d5
But my "test" varible should be populated with a collection. How can I print out my object????

One of the methods in your Object should be public String toString().
In this method, iterate over the collection in your object and print out the bits of readable data you think would be useful to display and append it to the end of a String that you return.

Similar Messages

  • How to print out time as hr:min:sec without AM/PM?

    how to print out time as hr:min:sec without AM/PM
    since hr specifies AM/PM. Thank you. My first thought
    is that there exists a formatter to do this. My second
    thought is that if not I can convert the AM/PM in the
    DateFormat.MEDIUM to the right hour.

    import java.text.*;
    import java.util.*;
    public class Test {
        public static void main (String [] args) {
            SimpleDateFormat format = new SimpleDateFormat("HH:mm:ss");
            Date d = new Date();
            System.out.println( format.format(d) );
    }

  • How to find out the Number range object for Incident number

    How to find out the Number range object for Incident number ?
    CCIHT_IAL-IALID
    regards,
    lavanya

    HI, an example.
    data: vl_num type i,
          vl_char(6) type c,
          vl_qty type INRI-QUANTITY,
          vl_rc type INRI-RETURNCODE.
    CALL FUNCTION 'NUMBER_GET_NEXT'
      EXPORTING
        NR_RANGE_NR                   = '01'
        OBJECT                        = 'ZRG0000001'
       QUANTITY                       = '1'
      SUBOBJECT                     = ' '
      TOYEAR                        = '0000'
      IGNORE_BUFFER                 = ' '
    IMPORTING
       NUMBER                        = vl_num
       QUANTITY                      = vl_qty
       RETURNCODE                    = vl_rc
    EXCEPTIONS
       INTERVAL_NOT_FOUND            = 1
       NUMBER_RANGE_NOT_INTERN       = 2
       OBJECT_NOT_FOUND              = 3
       QUANTITY_IS_0                 = 4
       QUANTITY_IS_NOT_1             = 5
       INTERVAL_OVERFLOW             = 6
       BUFFER_OVERFLOW               = 7
       OTHERS                        = 8
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    vl_char = vl_num.
    write vl_char.
    Regard

  • How to print HTML contents

    can anyone tell me how to print HTML contents...i needed it urgently
    Thanks

    actually i have a print button on html page....when i click on print button using window.print(); the html page gets printed...but along with it print button is also printed...i dont want print button to be printed...
    this is the issue...
    please resolve it
    Thanks a lot...

  • When I type a document and try to save it, there are black lines over my sentences, as if it had been highlighted, and that's how it prints out, just black lines

    when I type a document and try to save it, there are black lines over my sentences, as if it had been highlighted, and that's how it prints out, just black lines

    Hi Vickey, S,
    Sorry for the delay in response. Is it happening with all the files?
    Also, please write the steps you are taking to type in the document.
    You might try uninstalling and re installing the Reader in case it is happening with all the files.
    URL to install the Adobe Reader is Adobe - Adobe Reader download - All versions
    Thanks,
    Vikrantt Singh

  • How to print Iview contents only

    Hello All,
    How to print IView contents only instead of the whole portal. If I use javascript function, it prints whole screen. I want to print only the IVIEW contents. IView has tableview.
    Thanks in advance,
    Praveen

    Hi,
    we are using a 7.0 SP 16 Portal.
    If you have an light portal with an low EPCF level maybe the option will not be shown.
    Try it with the default SAP Portal Style as admin in that case you have an high EPCF level and you also should see the print option.
    If your iview is embeded inside a page this can have different effects. Please test it with an stand alone iView before.
    So with the high EPCF level the default portal style a single portal iView and the print option set to true you should see and use the print option.
    The option "Show print option" is not for every iView type avaible for example web dynpro iViews has that option this i know for sure, because i use this option with web dynpro iViews.
    Maybe you can build this function by your own i did this also with the following code. Maybe you can adapt that code:
    String p1 = WDProtocolAdapter.getProtocolAdapter().getRequestObject().getParameter("PagePath");
    String p2 = WDWebContextAdapter.getWebContextAdapter().getRequestParameter("sap-ext-sid");
    String p3 = WDWebContextAdapter.getWebContextAdapter().getRequestParameter("sap-wd-cltwndid");
    String[] url = wdThis.wdGetAPI().getComponent().getApplication().getURLService().getGeneralService().getAbsoluteWebResourceURL(wdThis.wdGetAPI().getComponent().getDeployableObjectPart().getName()).split("/");
    parameter = p1 + "&iview_mode=default&sap-wd-renderMode=print&sap-wd-cltwndid=" + p4 + "&sap-wd-cltwndid-print=" + p4 + "&sap-wd-pb-ext-sid=" + p2 + "--" + p3 + "--&IviewPrint=true";
    String newUrl = "http://" + url[2]+ "/irj/servlet/prt/portal/prtroot/com.sap.portal.pagebuilder.IviewModeProxy?iview_id=" + parameter;
    kind regards
    Fabian
    Edited by: Fabian Eidner on Mar 23, 2009 3:40 PM

  • How to print out answers using the form I created

    I created an application form for my company. People have submitted their applications, but I do not know how to print them out.
    Is there a way to copy the answers into the form and print that? Or something like that?
    I cannot just print the answers because it's over 100 pages and would be disorganized.
    I basically just need to know how to print out the form I created with the respondants answers.
    Thanks

    Here is what you can do...
    Open the form file
    Go to the View Responses tab
    Select the View menu in the upper right corner of the UI
    Select the Details View menu item on that menu
    The Details View pane will open on the right side of the window
    At the bottom of that pane there is a set of buttons
    The first button let's you print the detail view of the currently selected response
    The last button labeled Export will create a PDF file of the selected response
    Is that what you were trying to accomplish? I'll admit that we need to make print and export to PDF more discoverable and easier to get to - that was too many steps
    Randy

  • How to print out multilingual reports from the main report using Xliff temp

    Hi all,
    How to print out multilingual reports from the main report using Xliff temp?
    When I want main report call subtemplate and finish xliff tranlation
    <?for-each@section:INVOICE?><?end for-each?>
    <?import:xdo://XXIH.XXNR_XXINVPRINT_SUB.en.FI/?>
    <?start:body?><?call:Header?><?call:Line?><?call:Weights?><?call:Banks?><?end body?><?call:Footer?>
    Prints out fine with Finnish translation
    But if I want in main program to check what language is used e.g.
    if trx_number = 142 call Finnish translation and if trx_number =144,
    call English translation.
    <?for-each@section:INVOICE?><?end for-each?>
    <?if:TRX_NUMBER=’142’?>
    <?import:xdo://XXIH.XXNR_XXINVPRINT_SUB.en.FI/?>
    <?start:body?><?call:Header?><?call:Line?><?call:Weights?><?call:Banks?><?end body?><?call:Footer?>
    <?end if?>
    <?if: TRX_NUMBER=’144’?>
    <?import:xdo://XXIH.XXNR_XXINVPRINT_SUB.en.US/?>
    <?start:body?><?call:Header?><?call:Line?><?call:Weights?><?call:Banks?><?end body?><?call:Footer?>
    <?end if?>
    Prints out always in English and never the Finnish translation.
    Program goes fine to if branch but does not print out Finnish
    Does anybody know what could be wrong?
    BR
    Kari

    Thanks Amit,
    I have two layout, main-layout and sub-layout
    Main layout call subtemplate
    I have registered layout and xliff-file
    Main template
    Localized Templates
    File Name           Language Territory
    XXNS_INVOICE_MAIN.rtf      English
    SUB template
    Localized Templates
    File Name           Language Territory
    XXNS_INVOICE_SUB.rtf      English
    Translatable Template
    File Name           Language      Territory
    XXNS_INVOICE_SUB.rtf      English      United States
    Available Translations
    Language Territory Progress
    English Finland Complete
    If main report call subtemplate and finish xliff tranlation
    <?import:xdo://XXIH.XXNR_XXINVPRINT_SUB.en.FI/?>
    Prints out fine with Finnish translation
    But if I want in main program to check what language is used e.g.
    if....
    <?import:xdo://XXIH.XXNR_XXINVPRINT_SUB.en.FI/?>
    .....end if;
    if....
    <?import:xdo://XXIH.XXNR_XXINVPRINT_SUB.en.US/?>
    .....end if;
    Prints out always in English and never the Finnish translation.
    Program goes fine to if branch but does not print out Finnish
    Do you it's set up problem or program problem
    BR
    Kari

  • How to print out the position of 2 dimension arrays?

    there are 2 dimension arrays, how can print out the position of value than 4?
    for example
    0 2 3 2 2 2
    0 1 1 2 5 3
    1 2 3 3 2 1
    print out:
    The pos is ( 5,2).

    Hello
    If I understand your question correctly, you are trying to print out the indexes where the value in your matrix is greater than 4
    If this is the case, then what you need to use is nested for loops e.g.
    for (int i = 0; i< array[0].length; i++)
    for (int j = 0; j< array[].length; j++)
    int value = array[i][j];
    if (value > 4)
    System.out.println("The pos is (" + i + "," + j + ")" );
    Regarding the syntax I have used to get the size of the array, I am not sure if this is correct, but you should have an idea of what I am doing.
    Sajid

  • How do I  print out the attributes of objects from a  Vector?  Help !

    Dear Java People,
    I have created a video store with a video class.I created a vector to hold the videos and put 3 objects in the vector.
    How do I print out the attributes of each object in the vector ?
    Below is the driver and Video class
    Thank you in advance
    Norman
    import java.util.*;
    public class TryVideo
    public static void main(String[] args)
    Vector videoVector = new Vector();
    Video storeVideo1 = new Video(1,"Soap Opera", 20);
    Video storeVideo2 = new Video(2,"Action Packed Movie",25);
    Video storeVideo3 = new Video(3,"Good Drama", 10);
    videoVector.add(storeVideo1);
    videoVector.add(storeVideo2);
    videoVector.add(storeVideo3);
    Iterator i = videoVector.interator();
    while(i.hasNext())
    System.out.println(getVideoName() + getVideoID() + getVideoQuantity());
    import java.util.*;
    public class Video
    public final static int RENT_PRICE = 3;
    public final static int PURCHASE_PRICE = 20;
    private int videoID;
    private String videoName;
    private int videoQuantity;
    public Video(int videoID, String videoName, int videoQuantity)
    this.videoID = videoID;
    this.videoName = videoName;
    this.videoQuantity = videoQuantity;
    public int getVideoID()
    return videoID;
    public String getVideoName()
    return videoName;
    public int getVideoQuantity()
    return videoQuantity;
    }

    Dear Bri81,
    Thank you for your reply.
    I tried the coding as you suggested
    while(i.hasNext())
    System.out.println( i.next() );
    but the error message reads:
    "CD.java": Error #: 354 : incompatible types; found: void, required: java.lang.String at line 35
    Your help is appreciated
    Norman
    import java.util.*;
    public class TryCD
       public static void main(String[] args)
         Vector cdVector = new Vector();
         CD cd_1 = new CD("Heavy Rapper", "Joe", true);
         CD cd_2 = new CD("Country Music", "Sam", true);
         CD cd_3 = new CD("Punk Music", "Mary", true);
         cdVector.add(cd_1);
         cdVector.add(cd_2);
         cdVector.add(cd_3);
         Iterator i = cdVector.iterator();
         while(i.hasNext())
           System.out.println( i.next() );
    public class CD
       private String item;
       private boolean borrowed = false;
       private String borrower = "";
       private int totalNumberOfItems;
       private int totalNumberOfItemsBorrowed;
       public CD(String item,String borrower, boolean borrowed)
         this.item = item;
         this.borrower = borrower;
         this.borrowed = borrowed;
       public String getItem()
         return item;
       public String getBorrower()
         return borrower;
       public boolean getBorrowed()
         return borrowed;
       public String toString()
          return System.out.println( getItem() + getBorrower());

  • How do I print out a vector of objects?

    Hi,
    I am having trouble printing out the contents of my vector. Can somebody please help me out. Im trying to create a vector of objects. I keep getting output like this:
    There are 5 total classes
    5
    ClassObject@13f5d07
    Here is my code:
    //Test.java
    import java.io.*;
    import java.util.*;
    import java.lang.*;
    public class Test {
            ClassObject co = new ClassObject();
            Vector vec = new Vector();
            public Test () throws Exception {
                    Read("input.dat");
            public void Read(String fileName) {
                    String num; //number of cells
                    String cells; //cell data
                    int x = 0;
                    try {
                            FileReader file = new FileReader(fileName);
                            BufferedReader in = new BufferedReader (file);
                            num = in.readLine();
                            int number = Integer.valueOf(num).intValue(); //convert string to int
                            System.out.println("There are " + number + " total classes");
                            while ((cells = in.readLine()) != null) {
                                    StringTokenizer st = new StringTokenizer(cells, "- ");
                                    while (st.hasMoreTokens()) {
                                           co.classNumber = Integer.valueOf(st.nextToken()).intValue();
                                           co.classRelation = Integer.valueOf(st.nextToken()).intValue();
                                          // System.out.println(co[x].classRelation);
                                           vec.addElement(co);
                                           x++;
                                    System.out.println("\n" + x);
                                    System.out.println(vec.lastElement());
                    catch (IOException e) {
                            System.out.println("cannot read file");
                            System.exit(0);
            public static void main (String[] args) throws Exception {
                    new Test ();
    //ClassObject.java
    import java.util.*;
    import java.lang.*;
    public class ClassObject {
            int classNumber;
            int classRelation;
    //input.dat
    5
    1-2 1-3 2-4 3-4 4-5Thanks!!!!!

    public class ClassObject
        int classNumber;
        int classRelation;
        public String toString()
            return classNumber + "-" + classRelation;
    }

  • How to print the properties in an object

    I have the following method that is meant to print all the details in a hashmap (allStudents). this hashmap contains references to objects of different students.
    what i need is to be able to print each object stored in allStudents, and each of those objects properties....
    Please show me the light!!!
        public void printAllStudents()
        for (Integer eachStudent : allStudents) //for each loop
             System.out.println(eachStudent);// prints out every element in set
        }

    Hi Kaj,
    So when I overide the toString method, and then call
    another method that prints out the contents of the
    objects held a Map, the toString formatted text is
    used? If so.. how does that work?For objects (as opposed to primitives), System.out.println() calls the toString method.

  • How to print out the Forms and Table fields relationship, data mapping?

    I create a forms and tables relationship inside the Form Developer 11g, once I created the Data relationships between the form data field and the Table column name. I don't have any command to print it out, such as Layout Wizard.
    Are there any programs on Windows platform can print it out?

    hi all,
    i have try to do this
    public static void Readbinary() throws Exception
              String file = "D:\\05-09.190501+0800";
              DataInputStream dis = new DataInputStream(new FileInputStream(file));
              //but then how to read the content ??????can you give me more hint ?????
    i have find the netflow v5 structure by C
    struct NFHeaderV5{
    uint16_t version; // flow-export version number
    uint16_t count; // number of flow entries
    uint32_t sysUptime;
    uint32_t unix_secs;
    uint32_t unix_nsecs;
    uint32_t flow_sequence; // sequence number
    uint8_t engine_type; // no VIP = 0, VIP2 = 1
    uint8_t engine_id; // VIP2 slot number
    uint16_t reserved; // reserved1,2
    struct NFV5{ 
    ipv4addr_t srcaddr; // source IP address
    ipv4addr_t dstaddr; // destination IP address
    ipv4addr_t nexthop; // next hop router's IP address
    uint16_t input; // input interface index
    uint16_t output; // output interface index
    uint32_t pkts; // packets sent in duration
    uint32_t bytes; // octets sent in duration
    uint32_t first; // SysUptime at start of flow
    uint32_t last; // and of last packet of flow
    uint16_t srcport; // TCP/UDP source port number or equivalent
    uint16_t dstport; // TCP/UDP destination port number or equivalent
    uint8_t pad;
    uint8_t tcp_flags; // bitwise OR of all TCP flags in flow; 0x10
    // for non-TCP flows
    uint8_t prot; // IP protocol, e.g., 6=TCP, 17=UDP, ...
    uint8_t tos; // IP Type-of-Service
    uint16_t src_as; // originating AS of source address
    uint16_t dst_as; // originating AS of destination address
    uint8_t src_mask; // source address prefix mask bits
    uint8_t dst_mask; // destination address prefix mask bits
    uint16_t reserved;
    but how to translate the structure to java,then get the data from the file ?
    Edited by: 903893 on Dec 21, 2011 10:52 PM

  • How to print the content of LinkedList int[] and LinkedList LinkedList ?

    Hi guys, its been a long time since i posted here, and now im coming back to programming using java. My problem is, how can i print the content of the list?
    Example:
    LinkedList<int[]> list = new LinkedList<int[]>;
    int[] input = {1,2,3,4,5};
    int[] input2 = {2,32,43,54,65};
    list.add(input);
    list.add(input2);
    how can i print all the content of the linkedlist?
    Please help me..I know its a dumb question but i really dunno how.
    here is the code:
    import java.util.LinkedList;
    import java.util.Scanner;
    import java.util.Arrays;
    public class Test{
         static void printThis(String[] in){
              System.out.print("Value: ");
              for(int i = 0;i<in.length;i++){
                   System.out.print(in[i] + " ");
              System.out.println();
         static void reset(String[] val){
              for(int i = 0;i<val.length;i++){
                   val[i] = "";
         public static void main(String[] args){
              LinkedList<String[]> list = new LinkedList<String[]>();
              LinkedList<String> listTrans = new LinkedList<String>();
              System.out.print("Enter the number of records: ");
              Scanner s = new Scanner(System.in);
              int numOfRecords = s.nextInt();
              System.out.print("Enter the number of records per run: ");
              s = new Scanner(System.in);
              System.out.println();
              int numOfRecordsInMemory = s.nextInt();
              String[] getData = new String[numOfRecords];
              String[] transferData = new String[numOfRecordsInMemory];
              int numOfRuns = 0;
              int counter = 0;
              for(int i = 0;i<numOfRecords;i++){
                   counter++;
                   System.out.print("Enter value number " + counter + ": ");
                   Scanner scan = new Scanner(System.in);
                   getData[i] = scan.next();
                   listTrans.add(getData);
              if(getData.length%numOfRecordsInMemory == 0){
                   numOfRuns = getData.length/numOfRecordsInMemory;
              }else if(getData.length%numOfRecordsInMemory != 0){
                   numOfRuns =(int)(getData.length/numOfRecordsInMemory)+ 1;
              System.out.println();
              System.out.println("Number of Runs: " + numOfRuns);
         int pass = 0;
         System.out.println("Size of the main list: " + listTrans.size());
         while(listTrans.size() != 0){
              if(listTrans.size() >= numOfRecordsInMemory){
                   for(int i = 0;i<numOfRecordsInMemory;i++){
                        transferData[i] = listTrans.remove();
                   System.out.println("Size of the list: " + listTrans.size());
                   printThis(transferData);
                   System.out.println();
                   Arrays.sort(transferData);
                   list.add(transferData);
                   reset(transferData);
              }else if(listTrans.size() < numOfRecordsInMemory){
                   pass = listTrans.size();
                   for(int k = 0;k<pass;k++){
                        transferData[k] = listTrans.remove();
                   System.out.println("Size of the list: " + listTrans.size());
                   printThis(transferData);
                   System.out.println();
                   Arrays.sort(transferData);
                   list.add(transferData);
                   reset(transferData);
    //This is the part that is confusing me.
    //im trying to print it but its not working.
              System.out.println("Size of the next list: " + list.size());
    //          for(int i = 0;i<list.size();i++){
    //                    System.out.println();
    //               for(int j = 0;j<list.get(i)[j].length();j++){                    
    //                    System.out.print(list.get(i)[j] + " ");

    Here's the funnest, mabye clearest way you could do it: Use 2 Mappers
    package tjacobs.util;
    import java.util.ArrayList;
    import java.util.Iterator;
    import java.util.List;
    import tjacobs.Arrays;
    public class Mapper <T>{
         public static interface MappedFunc<T> {
              void map(T value);
         public Mapper(T[] vals, MappedFunc<T> function) {
              this (new Arrays.ArrayIterator<T>(vals), function);
         public Mapper(Iterator<T> iterator, MappedFunc<T> function) {
              while (iterator.hasNext()) {
                   function.map(iterator.next());
         public static void main(String[] args) {
              String[] s = new String[] {"a","b", "c", "abc", "ab"};
              MappedFunc<String> func = new MappedFunc<String>() {
                   public void map(String s) {
                        if (s.toLowerCase().startsWith("a")) {
                             System.out.println(s);
              Mapper m = new Mapper(s, func);
    }

  • How to print out fillable fields only

    I'm a newb, help! I am trying to create a form in LiveCycle.
    I have brought in a pdf, made some fillable fields. So far so good, here's where I'm struggling.
    I want the recipient of the pdf to fill out the forms, (while still seeing the pdf in the background), BUT when they print, I want them to ONLY print out the information that they filled in the fillable fields.
    So basically, they receive a document in Adobe Reader, it has a pdf in the background, and they fill in some fields, then they place a page in their printer to just print the fillable fields only.
    Does anyone know if this is possible?

    "You can control the visibility of objects using the presence property"
    Here is where I get confused. I understand that you can change the visibilty in this area, but I want the pdf background that is part of my form to be the area that doesn't print, so I can't understand how I highlight that particular area to switch it to "screen only" because it isn't really considering a text field or anything like that, it was just a pdf that I imported from the start and then built all my text fields on top of.

Maybe you are looking for

  • 5th Gen iPod and 2nd gen Nano will connect to Mac, not found by iTunes

    I bought a brand new MacBook running OSX 10.4.9, and I cannot get my 5th gen iPod video nor my 2nd gen Nano to be recognized by iTunes. The computer recognizes that there are two drives-- they come up on the desktop. But iTunes will not notice them,

  • Payment terms with disounts

    Hello! I try to create a payment terms with three disounts. It s about a 90 days end of month on the tenth with 1 different discount for each of the 3 month. Example : Baseline date is 10 M-4 0,6  % disount if customers pay before the 30th M-3 of the

  • I did not find iPhoto in mac book pro

    i bought a mac pro and i did not find the backages of iphoto and imovie

  • Diff Between widening Cast & Narrowing Casting

    Hi, What are differences between widening Cast & Narrowing Casting ? Give some exaples also. Thanks

  • Access a WS defined in XI from NWDS

    Hi, I've configured a SOAP Adapter in XI. I can access it from XMLSpy with success. Inside NWDS, I've created a new portal component. I've added a new portal service with the wsdl generated by IB:Design. I have also added a DynPage like in the exampl