Print values to console

Please tell me how do u print values of a collection or an arraylist to console to check what a collection or an arraylist contains in it
for debugging
any help appreciated

System.out.println(<theNameOfTheCollection>);

Similar Messages

  • How to print values in a HashMap

    Hi
    I am new to Java
    I am using a HashMap where key is a String and the Value is again a HashMap..
    Firstly can I use it this way ...If not could you please suggest an alternative...
    If I can use it ...
    I am unable to print the values in the HashMap..
    Here "map" is a HasMap I am using..
    and I used
    map.put("name",secondMap);
    My code is
    public void printMap(Map map)
              Set keys = map.keySet();
              Iterator keyIter = keys.iterator();
              while (keyIter.hasNext())
                   Object key = keyIter.next();
                   Object value = map.get(key);
    // Here the value is again a HashMap
                   HashMap valuesMap=(HashMap)value;
                   System.out.println("KEY" + key.toString() );
                   if(valuesMap!=null)
                        Set set = valuesMap.keySet();
                        Iterator setit = set.iterator();
                        while (setit.hasNext())
                             Object keyinMap=setit.next();
                             Object valueinMap=valuesMap.get(key);
                             System.out.print("value is"+valueinMap);
    Can anybody help me in this regard.
    Thanks in advance

    Hmm, this looks pretty good to me. What behavior does this give you? For example, do you see "KEYname" printed? Are you sure that "map" is actually the same one you added "secondMap" to?

  • My program isn't printing to the console.....

    Hi I'm new to the forums and Java. I'm trying to get my program to print to the console but nothing prints when I run it. There isn't any errors displaying so I'm guessing there is a problem with the syntax of my constructor. Did I write the methods incorrectly to where my System.out.print isn't getting the data from the rest of my program?
    public class Stock {
         public static void main(String[] args) {
         public Stock() {
         public Stock(String symbol, String name){
         public String getSymbol(){
              return "ESI";
         public String getName(){
              return "ITT Technical Institute";
         public double getPreviousClosingPrice(){
              return 60.0;
         public double getCurrentPrice(){
              return 65.0;
         public void setSymbol(String symbol){
              System.out.print("Symbol: "+ symbol);
         public void setName(String name){
              System.out.print("Name: "+ name);
         public void setPreviousClosingPrice(double price){
              System.out.print("Previous Closing Price: "+ price);
         public void setCurrentPrice(double price){
              System.out.print("Current Price: "+ price);
         public double changePercent(double PreviousClosingPrice, double CurrentPrice){
              double ChangePercent;
              ChangePercent = (CurrentPrice - PreviousClosingPrice)/PreviousClosingPrice * 100;
              return ChangePercent;
    }

    Thanks everybody for the input. I originally had all of my methods within the main blocks, but I ended up getting three errors. I'll work on this more on Wednesday when I have some free time and post what I've corrected and changed. Again thanks.
    public class Stock {
    public static void main(String[] args) {
    public Stock() {
    public Stock(String symbol, String name){
    public String getSymbol(){
    return "ESI";
    public String getName(){
    return "ITT Technical Institute";
    public double getPreviousClosingPrice(){
    return 60.0;
    public double getCurrentPrice(){
    return 65.0;
    public void setSymbol(String symbol){
    System.out.print("Symbol: " symbol);
    public void setName(String name){
    System.out.print("Name: " name);
    public void setPreviousClosingPrice(double price){
    System.out.print("Previous Closing Price: " price);
    public void setCurrentPrice(double price){
    System.out.print("Current Price: " price);
    public double changePercent(double PreviousClosingPrice, double CurrentPrice){
    double ChangePercent;
    ChangePercent = (CurrentPrice - PreviousClosingPrice)/PreviousClosingPrice * 100;
    return ChangePercent;
    }

  • Set default value in console.

    Hii all
    I have to set default value in console while running program .. let suppose application is needed username and password .. when it start .. firstly will display ��UserName: ADMIN.. and ADMIN would be editable � let suppose if user want to login with same username then would press enter ..otherwise will edit username with desired name �and so on� so my query is ......is it possible to make any field editable in run time ?? if ya plese give me some sample code..
    Thanks in advance..
    Vaibhav

    hello,
    please let me know ... how can I make my code editable .... give me some sample code... if possible
    Regards
    Vaibhav

  • Problem with getting unicode values from console

    Hi,
    In my application I am passing unicode value like \u00DF from console. and writing this string value to a utf8 file. But in the file the value is printed not the actual unicode character.
    Where the things are getting wrong.
    I have declared a string in java like ;
    String abc = "\u00DF";
    and printed this to a utf8 file, it works fine and the corresponding unicode character for \u00DF is printed.
    Why the unicode value passes from console is not working property. How can i resolve this ?
    Thanks in advance...
    <!--Session data-->

    And how are you putting it into the console in the first place?

  • How to manipulate data printed on system console

    hello,
    I send a command action to an Asterisk Server and get its result printed on the System Console in Netbeans IDE. Its something like this:
    | Name/Username | Host | Mask | Port | Status |
    Now, I would like to add only the first column of the result printed out, to a HashMap using .put method.
    How do I access the data printed on the System console? or is there another way?? Kindly help as I am new to this field.
    Thanks n Regards
    Aparna

    Yes, but I do not know how to add just the first column to the already existing list. This is what I do:
    public void CommandAction() {
    CommandResponse response;
    Iterator lineiterator;
    try {
    action.setCommand("sip show peers");
    response = (CommandResponse) managerconnection.sendAction(action);
    linIterator = response.getResult().iterator();
    while(lineIterator.hasNext()) {
    System.out.println(lineIterator.next());
    catch(Exception e){}
    }How can I add the value of the first column from the AsteriskServer Console to the list?
    Kindly help.
    thanks
    Aparna

  • Printing value fields with negative sign??

    Hello Experts,
    I have developed a interface, which writes the invoice data to application server/unix, this is a notepad. My specifications are as below,
    MWSK1(2)   TaxCode                         65     2     KONV-MWSK1     
    KWERT(13)  Condition Value                  67     13   KONV-KWERT     
    KSTEU(1)  Condition Control                80     1     KONV-KSTE
    I have to print KWERT value from 67th position until 13 positions, meaning until 80 positions, fine. My code is as below,
      MOVE: wa_invoice_price-mwsk1  TO unix_file+64(2).
      WRITE: wa_invoice_price-kwert    TO unix_file+66(13) RIGHT-JUSTIFIED.
      MOVE:  wa_invoice_price-ksteu    TO unix_file+79(1),
    So, it printing like below (pls. note 0.04 minus value in right bottom corner)
    P26701ZCG620101006C          100.00         0.00USD  1    UGL            0.00A A 9
    P60001ZF3520101006C          100.00         0.00USD  1    UGLG          0.04-H B 9
    But, business want to have like below (pls. note the DIFFERENCE for 0.04 minus value in right bottom corner),
    P26701ZCG620101006C         100.00        0.00USD  1    UGL               0.00   A A 9
    P60001ZF3520101006C         100.00         0.00USD  1    UGLG             0.04 - H B 9
    meaning, the 13th position should be negative sign (if at all any value does have a negative sign, else its normal)....so, the negative sign should sit on 13th postion. As am using WRITE statement with RIGHT JUSTIFIED am facing thisissue!! as u know we can not send a 'P' type value to unix/apps server, pls. let me know how to get it done?
    Thank you

    why can't the user live with a leading sign, like '-   0.04'?  If possible, do
    shift <fieldname> circular up to '-'.
    Or, if value is less than zero, set another variable to '-', else set to space, and multiply value with '-1', like:
    if <field> < 0.
       lv_sign = '-'.                " neagtive value
      <field> = <field> * '-1'.  "reverse the sign
    else.
    lv_sign = space.          "positive value
    endif.
    then, adjust your field length and insert a sign column or simply add a column for the sign....

  • Displayed values and printed values are different.

    I have multiple pages in PDF and each page consists of multiple form fields.The data in form fields displays the correct values but when on clicking on any
    of the field value is getting changed(the value in 1st page is getting displayed for the remaining all pages) and on click on some other location value again restores.
    On printing the PDF the values in the 1st page getting printed in all the pages.This is a bit urgent and need help on this.Using Adobe 9.0 standard version

    Hi Anshuka ,
    Make sure that the form field does not have the same name ,that may be a possible reason you are getting the duplicate values for rest of the pages.
    If possible please share the PDF with me so that I can have a look at it and assist you further.
    Regards
    Sukrit Dhingra

  • Help needed with MMAPI and print values to screen

    Hi,
    Using the RingToneConverter, I want to print out the values to the screen that the ring tone has. The values I want printed are actually any values at all! I am not picky at this point!
    Can anyone help with this? I would like it so that while the ringtone is playing the the "simple player", the values are somewhere on screen appearing. Or even after the song is finished, the values come up on screen.
    Thank you,
    Mike

    Sorry, i don't mean that..
    as i say, as3 read the data from file sorting like that:
    1,john,ny
    2,jessy,cal
    3,smith,nj
    how can i pass those values to the textboxes . id , name , address
    so i can go next and previous
    thank you again..

  • Flex 3  :How to use trace for printing data in console

    Hi ,
    I heard that we can use trace to print data on to Flex Builder 3 console . But when i tries it was of no luck .
    The below is a simple program , in which i was out of luck .
    public function callMe():void
                trace("AAA");
    <mx:Button id="Register" name="Register" label="Register" height="23" click="callMe()"/>
    Here in the above porogram , after clicking the Button , i cant see 'AAA 'related  inside my Flex Builder .
    Any help ??
    Thank you .

    Hi Kiran
                Make a break point at trace line and debug the application  There u can find the message u typed in console..  trace works only under debugging mode... not in development mode ..
               Have a nice day
    Thanks
    Ram

  • Bonjour printing error in console.log and cups error_log

    Hi everyone,
    I have a client who has been successfully printing to an HP LaserJet 4000 over his home LAN for some time now. However, this evening he was no longer able to print, with the print queue stopping immediately when he would try.
    iMac (Intel) Core Duo, Mac OS X 10.4.8, connected through a D-Link DI-524 wired/wireless router. There is a D-Link DP300U print server connected to one of the LAN ports on the router, to facilitate printing to a printer that has not been connected to the LAN recently.
    After using Printer Setup Utility to reset everything, repair permissions, etc., the system still would not print. No updates have been installed since the last week of January 2007, and printing has been fine since then.
    The only clue I was originally able to come across was found in console.log:
    ~ ~ ~ ~ ~
    No log handling enabled - turning on stderr logging
    snmpInk: Unknown host (SMB-Maui\0321.local.)
    ~ ~ ~ ~ ~
    Then, I looked under /var/log, under the cups disclosure triangle, at error_log:
    E [14/Feb/2007:20:50:44 -0800] [Job 2] Unable to locate printer 'SMB-Maui\0321.local.' - Unknown host
    E [14/Feb/2007:20:50:44 -0800] PID 282 stopped with status 1!
    ~ ~ ~ ~ ~
    There is only the one Mac on the LAN, which is not named "SMB-Maui"-anything. I was able to get printing to function via AppleTalk once it was enabled, but the client has been printing successfully via Bonjour for some time and so there seemed no reason why this should simply "happen". No new software has been installed, as he's really quite good about leaving the system alone to do its thing.
    Disk Utility repaired multiple print-related permissions errors before I began using Printer Setup Repair.
    I'm looking for troubleshooting steps to take beyond this point. While the client is satisfied that he can now print via AppleTalk, I am not and would very much like to resolve the lower-level problem. Please advise?
    Thanks much for your time,
    MBJ

    Hi Phil,
    Thanks much! I think you might be on the right track, as I got some unexpected results from Bonjour Browser.
    First of all, there's no Internet Printing Protocol (IPP) entry at all—in fact, several others I have present on my own, local system are not to be found on the remote iMac. What the iMac does show is the following:
    local - 3
    Apple Remote Desktop (net-assistant.udp.) - 1
    iMac
    (IP address):3283
    [(IPv6 MAC address)]:3283
    Remote Frame Buffer (rfb.tcp.) - 1
    iMac
    (IP address):5900
    [(IPv6 MAC address)]:5900
    Workgroup Manager (workstation.tcp.) - 1
    iMac [MAC address]
    [(IPv6 MAC address)]:9
    (IP address):9
    I have reapplied the 10.4.8 Combo Update, with no effect to the problem itself, nor to what is showing in Bonjour Browser.
    One other possible clue: A visitor on the home LAN did attempt to print from Virtual PC 7 on a portable they had brought with them. They were unable to do so from Windows XP, but could print properly from Mac OS X. There is no known, causal relation to the problem at hand here - I mention it to be thorough, no more or less.
    I'll standby for your further thoughts!
    Thanks much for the assist,
    MBJ
    Hi Mike,
    Bonjour is a service discovery system. It doesn't
    print. For
    that you use ipp or lpr, etc. The reason why
    Appletalk works
    is that it has its own discovery system. It's older
    and
    apparently more reliable. Bonjour uses muticast ip
    but
    unless muticast requests are forwarded can't get
    outside
    a local subnet.
    Once on your net was a machine - probably a samba
    server -
    named "maul". Must have been, it's in a mib
    somewhere. Oh
    wait - maybe it's cached in the dlink from its old
    days on
    the dark side!
    Judging from the direction of the slash it was a
    Windows
    machine (I don't think that's an octal 321). CUPS
    thinks
    that's where the printer is. Normally cups discovers
    the
    printers via bonjour, and bonjour must be coming
    back
    with the wrong info!
    But bonjour isn't that smart, something must be
    tricking it.
    There's a wonderful free utility called "Bonjour
    Browser"
    which will show you which services are being
    announced.
    Give it a try:
    http://www.versiontracker.com/dyn/moreinfo/macosx/2162
    2
    Let me know what it shows under ipp.
    -Phil
    Powerbook G4, iMac
    (Intel), and tons of hardware sitting in the closet
      Mac OS X (10.4.8)  
    Power Mac G4 (QuickSilver 2002), 20" Cinema Display (ADC)   Mac OS X (10.4.8)   Dual 1.0 GHz G4/1.5 GB RAM/2x160 GB HD/SuperDrive/GeForce4 Ti/PCI USB 2.0&FW400

  • Help in  printing values

    Hi all,
    I have a procedure getUser which takes IN username as inout and 2 table of object as OUT parameter.I have equated all the values but want to check if the values have been passed properly by printing those values in the following anonymous block.So can anyone please help me to do this.
    DECLARE
         a     XXAM_USER_ATTR_TBL;
         b     XXSSM_ERROR_MESSAGE_TAB_TYPE;
         retval varchar2(40);
    BEGIN
         getUser('msander',a,b);
    END;
    -- I want to print those values that are present in the xxam_user_attr_tbl
    -- xxam_usr_tbl is a table of xxam_user_obj
    --xxam_usr_obj has two attribute userid and accessid                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Hi Jen,
    I think I am making some mistake in the procedure itself.But when I run the procedure it seems to be valid.So can you please point out to me if I am doing any mistake...Thanks in advance...
    Cheers,
    AK
    Hi
    CREATE OR REPLACE PROCEDURE getUser(
    p_user_name IN      varchar2,
    x_user_attributes OUT      XXAM.XXAM_USER_ATTR_TBL,
    x_error_table OUT      XXSSM_ERROR_MESSAGE_TAB_TYPE)
    IS
    TYPE user_value IS TABLE OF VARCHAR2(20);
    xx_value user_value := user_value('null','null','null','null','null','null','null','null','null','null','null','null','null','null','null');
    xx_user_attributes XXAM.XXAM_USER_ATTR_TBL      := XXAM.XXAM_USER_ATTR_TBL();
    THere is a bunch of code that actually get the values from the LDAP server and stores them inside TYPE user_value.I tried to print all the values that exist inside the TYPE user_value and everything is just fine..SO i think that I am making a mistake in assigning the values to the Table of objects XXAM_USER_ATTR_TBL .
         --Assigning the values to the object XXAM_USER_ATTR_TBL.
         xx_user_attributes := XXAM.XXAM_USER_ATTR_TBL();
    xx_user_attributes.EXTEND ();
         xx_user_attributes(1) := XXAM.XXAM_USER_ATTR_OBJ.getObject();
         xx_user_attributes(1).USER_NAME                         :=     xx_value(1);
         xx_user_attributes(1).ACCESS_ID           :=     TO_NUMBER(xx_value(2));
         -- Disconnect from the LDAP server.
         l_retval := DBMS_LDAP.unbind_s(l_session);
    END getUser;
    /

  • ABAP-Printing values in words in Scripts

    Dear all,
    If i have made a Zscript Can i include functionalities like converting the amount into words etc.
    For Ex If the total amount is 1200 Rs and 85 Paise (1200.85) If i want to print it in words with appropriate currency, what i need to do?
    I really appreciate a detailed answer on this.
    Thanks and Regards
    Shrinivas
    <MOVED BY MODERATOR TO THE CORRECT FORUM>
    Edited by: Alvaro Tejada Galindo on Dec 23, 2008 10:11 AM

    Hi,
        Do the necessary coding in the driver program, and store the values in a variable, and in script give that variable. If it is a standard driver program, use a subroutine for that script, using PERFORM statement.
    Use this FM for conversion to words
    SPELL_AMOUNT
    Regards
    Bala Krishna

  • Java - Eclipse debug applet with System.out.print in jboss console

    I use System.out.print to debug my java programs using Eclipse. I'm new
    with applets, and when nothing showed up in the applet window, I tried
    using print statements. I was expecting to see them in the jboss console like
    always, but there was nothing there. I tried looking this problem up
    online and found nothing. Does anyone know how I can use print
    statements to debug my applet? (Japplet to be specific).

    System.out.println works for me. The output statment are visible in the Console Window within Eclipse.

  • How to print value with ""

    Hi All,
    I am trying to print a String with "Value" can anyone please provide me a code sample for that.
    What I am trying to print is -
    String Result = "a" + "b";
    System.out.println("Result = " + Result );
    This is giving me Result = ab
    Where as I want Result = "ab"
    Thanks in Advance
    Sameer

    public static void main(String[] args)
            String result = "\"ab\"";
            System.out.println( result );
        }The " is a special character in java. If you want to add a " to a string you must first escape it with a slash like so \"

Maybe you are looking for

  • Msync not synching all data

    I am working through the "mobile filed service" (task) tutorial in the 9i lite docs. Msync is running successfully and when I first use it everything looks ok. I did an update on the client db and ran msync, that was replicated on the server. Next I

  • Embedded fonts with rich editable text

    Hi, I am trying to use my embedded fonts in rich editable text field, but it only works for users that already have that font installed on their system. This is what I do. I embed fonts like this:      @font-face {             src:url("fonts/Cantarel

  • HT1414 i updated i tunes and it delited all my songs and apps

    i updated i tunes update on my ipod and it has wiped all my songs and games can i get them back???

  • RSS Feed Counts not updating between computers via iCloud

    MobileMe used to sync my read counts for my RSS feeds in Safari. If I read something on my iMac, my mbair shows that article as read. This no longer seems to work with iCloud. Has anyone found a work around? I like checking RSS feeds via Safari, but

  • Movie rentals on Apple TV - SHOCKING

    I recently bought a 3rd gen Apple TV and downloaded a movie to watch on Apple TV, then it disappeared.  I had to start the whole process again, taking another hour and a half.  Is this normal?!?!  On most other services the movie is ready to watch in