Printing out char data type - unexpected results

Hi, I have just started programming, and my first language is Java. I'm using JDK6 update 1.
Scenario 1: - When I do System.out.println(string1 + string2); where string1 and string2 are String variables, the result is as expected.
Scenario 2: - When I do System.out.println(string1 + char1); where string1 is a String variable and char1 is a char variable, here also the result is as expected.
Scenario 3: - But when I do System.out.println(char1 + char2) the output is some numbers (I got output 22 when char 1 is 'P' and char2 is 'I').
Could someone please explain scenario number 3? How do I achieve a concatenated output of multiple chars?
Thanks.

Thanks, so if I understand this right, the + operator works for Strings but is not meant for chars. When I think about it now, it seems right, because a char will always ever be only one character, and never more than one character.

Similar Messages

  • Print out  for movement types

    Hi Friends,
    How to  configure print out for movement type 561 or for scrap ?
    Can you pl tell me step by step where and how to configure?
    Appreciate your help.
    Thanks,
    Venkat

    Hi Venkat,
    What you want to print. if you only want to print out the transaction done thr movement type 561. If you are not going through any development then follow the under mentioned process :
    Go to MB51- Select the material, Plant & storage location- put the movement type 561 & 562- select the ranges of date- execute it. System will give the report. Then for print out go to List tab and select the print. After clicking on the print tab, you have to fill some informations like- Output device- Put Locl then No of copies-then click on continue. System will give you to select the printer. Just select and print.
    If this is enough then ok otherwise inform me.
    Hope this will clear your issue.
    T & R,
    Brijesh

  • How to print out the data from the file ?

    hi all,
    i have upload my file to here :
    [http://www.freefilehosting.net/ft-v052010-05-09 ]
    anyone can help me to print out the data from the file ?
    the content of the file should be like this :
    185.56.83.89 156.110.16.1 17 53037 53 72 1
    and for the seven column is
    srcIP dstIP prot srcPort dstPort octets packets

    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 out a date from the past

    I am trying to print out a date from the past but I cant seem to get It,
    Lets use for example Independece Day,
    How would you write the code in order to print out that exact date?

    Look at the
    [url=http://java.sun.com/javase/6/docs/api/index.html?
    java/util/Date.html]Date APIActually the Calendar class would be better to use, since you can set all the different fields from year to second, plus things like day of week, day of month, week of year, etc.
    too slow
    Message was edited by:
    hunter9000

  • Print out a Date in a format I want

    Now if I print out a Date object, I will get something like "Sat Jan 01 00:00:00 CST 2005", but what I want is "1/1/2005". I tried to use the get methods to get the month, day, and year so that I can put them in a format I want. However, all the get methods have been deprecated. What will be a possible(maybe easy as well?) way to do it? Thanks.

    Something like:
    import java.util.Date;
    import java.text.DateFormat;
    import java.text.SimpleDateFormat;
    public class Test {
        public static void main(String[] args) {
            DateFormat df = new SimpleDateFormat("d/M/yyyy");
            Date now = new Date();
            System.out.println(df.format(now));
            // new for Java 5.0 - almost the same format
            System.out.printf("%te/%<tm/%<tY%n", now);
    }Note: If you're using Java 5.0, then you can use the new printf method for PrintWriters. However, this doesn't appear to have a formatting token for single digit months.
    http://java.sun.com/j2se/1.5.0/docs/api/java/util/Formatter.html#dt
    Cheers, Neil

  • Char data type in mvc

    Char data type taking the numeric value  instead  of char data type while binding in the Mvc view

    For MVC questions please use the ASP.NET forums:
    http://forums.asp.net/1146.aspx/1?MVC

  • Initialization for char data type?

    I observed that as String I can declare something like this:
    String str = ""; but for char data type, if I declare:
    char ch = ''; the compiler will have an error: "empty character literal". So how can I fixe this problem when I want to initialize my char variables as "empty"? Anyone got an idea?
    Message was edited by:
    hoangSoccer
    Message was edited by:
    hoangSoccer

    Strings (and StringBuffers/Builders) are collections* of characters - so it makes
    sense to be able to refer to a String with precisely zero characters. But char is not a collection of anything - it has whatever value it has and can never
    be empty.
    *collections with a small 'c'.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • How to call VC++ dll whiich return char[] data type value in powerbuilder

    Hi Everyone,
    I am using PowerBuilder 11.1 build 8123.
    I am calling VC++ DLL in our PowerBuilder application which return char[] data type value.
    I just declare Global External Function:-
         Function  char getOSSectionName() library "DocServClient.dll" alias for "getOSSectionName;Ansi"
    And then call this function in window as:-
         Char      ls_section[1] = 'DOCAPPLICATIONS9X'
         ls_section[1]=getOSSectionName()
    When I check ls_section[1] value in messagebox it display a symbol (please check attached attached image.)
    VC++ function and return variable declaration:-
         __declspec(dllexport) char *  __stdcall getOSSectionName()
           char    SectionName[_MAX_PATH];
    Please let me know that my code is valid or not.
    Please help..

    Hi,
    Thanks to Everyone for your suggestions.
    I am solved my problem to change VC++ function as :-
         Int __declspec(dllexport)  __stdcall getOSSectionName(char* SectionName)
                        instead of
         __declspec(dllexport) char *  __stdcall getOSSectionName()
    and declare global function as:-
           Function int getOSSectionName(Ref char ls_section[100]) library "DocServClient.dll" alias for "getOSSectionName;Ansi"
    and call function in window as:-
         int li_ret
         char ls_section[100]
         string ls_sec
         li_ret=getOSSectionName(REF ls_section)
         ls_sec=ls_section
    Thanks,
    Vikrant

  • Does CHAR data type work with Forms 11g

    We have an application in Forms 11g (32bit - version 11.1.2.0.0). DB is a Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production.
    When our Forms calls a stored procedure which has parameters defined using column name type (i.e. like p_customer_code customers.code%TYPE ) and if the column data type is CHAR we get a run time error when executing the package (ORA-06502: PL/SQL: numeric or value error string).
    When we change the data type of the tables column to varchar2, it works??
    Problem is we have dozens of tables with CHAR data type columns and we can't do all the changes manually. For one thing, if they are part of a primary or unique key or even foreign key, we can't change the data type of the column without dropping the constraint.
    What is the solution to this pls??

    When our Forms calls a stored procedure which has parameters defined using column name type (i.e. like p_customer_code customers.code%TYPE ) and if the column data type is CHAR we get a run time error when executing the package (ORA-06502: PL/SQL: numeric or value error string).this might also be related to compile settings, check your NLS settings (NLS_LANG, NLS_LENGTH_SEMANTICS) both times when you compile forms AND your stored procedures.
    As for the CHAR datatype: CHAR internally is treated like a blank padded varchar:
    http://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:1542606219593
    Speaking of that it might be time to use varchar2 instead your char columns. You'd have to drop and recreate your constraints, but with the help of the data dictionary (+user_tables+, user_tab_cols, user_cons_columns, user_constraints) and dbms_metadata this shouldn't be that hard.
    Also you'd of course need to recompile all your forms after you are finished, but I guess you are aware of that ;)
    cheers

  • How do I get the system to print-out a date at the bottom of page?

    When I am at a website and ask for a print-out of the page -
    the current date and time of print-out no longer appears at the lower right corner of page.

    I have resolved the problem. I will not use your time attempting to explain the process of elimination. However, the end result---
    I had taken delivery of a new printer mid-January - it is a HP OfficeJet 6000 (E609) - I wondered if that might be the problem - since I could not ascertain exactly when the print-out problem had presented itself.
    O.K. I logged on to the system and brought up the "Google" page to ask for a print-out. I checked for a print - and when the print box appeared I checked on "properties". That showed - to the left: "General Everyday Printing" and over to the right: Page size "A4 210 x 297mm" also the option "letter 8.5" x 11" and Legal 8.5" x 14" - so, I changed it to ask for the "letter - 8.5" x 11" - then I checked to "print" - I believe it was the "OK" - and the "Google: page was printed intact - showing the data generally associated with the top of the page and the date/time at the lower right.
    I placed a telephone call the HP this morning to ask them about the "A4" option and was advised that it is a "standard size paper" - but could not explain under set of circumstances it would be applicable.
    Hopefully, this data will be helpful to someone - thank you very much for your assistance in this matter.

  • PO Print out and data issue in Aribic Language -AR

    Hi Guru,
    Thanks in advance..........
    I am facing problem in PO print out in AR language.
    When i print Compnay phone no. of PO in E language is printing correct like - +962 4400402
    But i select message type 'AR' then Company Phone No. printing like this - 96264420404+.
    Can any one can suggest we have any FM for converting telephone no. in AR language in same format - like +962 4400402.
    Regards
    Durgesh

    Hi,
    I think it is the issue of text wrapping.
    Are you using different text elements to display this text or same in both languages?
    Thanks,
    Archana

  • Dates in BEx query coming into designer as a dimension with Char data type

    This must be an old issue with a well documented work around ...   but alas i can find it !
    When i build a universe over a BEx query with dates the universe designer builds them as Dimensions of CHAR type not DATE.  Therefore all WebI date functionality fails ..  eg sorting, automatic time hierarchies etc.
    What is the workaround ?
    Andrew Fox

    Is the data source an InfoSet or an InfoCube?  It appears the date type object has not been implemented yet for Infosets.  Here's SAP Note 1370410:
    Symptom
    Infoset date type objects (DATS type) are mapped as Character types in a universe based on a SAP BEX Query.
    Prompts related to the Date field variables are coming as List of values instead of Calendar in WebIntelligence.
    Reproducing the Issue
    Create a BusinessOjects universe on a Super Query which is based on a multiprovider containing an Infoset or
    Create a BEx superquery directly on Infoset.
    BusinessObjects Enterprise XI 3.1
    SAP Integrated Solutions Kit XI 3.1
    Cause
    This behaviour has been considered as an enhancement request and tracked under ADAPT01229917.
    Resolution
    This enhancement request is scheduled to be addressed in Service Pack 3 (SP3) for BusinessObjects Enterprise XI 3.1 due approximately April 2010.
    I did try a BEx query that uses an InfoCUBE as a source and the objects are coming into the universe correctly as dates.

  • When I print out photo thru iPhoto, the result is too dark.

    Hi all,
    I have a problem with printing a photo via iPhoto recently.
    I remember when I used iPhoto 9 to print out some of my photos but at that moment the result was pretty OK to me.
    However, I don't know exatly when but I guess it could be since I upgraded to iPhoto 10...
    Everytime I tried to print out some of my photos from my iPhoto library, the result is way too dark than its original color.
    I am using HP Photosmart device(C410ㅁ) with fuji photo papers.
    I tried to change several options like color sync or printing quality but NO use!!
    Strange thing is that if I use airprint with my iPhone or iPad, color level seems to be OK.
    But again, iPhone airprint doesn't give any options to manage printing quality level, it couldn't mitigate my problem, either.
    Is there anyone out there who has the same or similar problem just like me?
    Please share your knowledge to solve this issues.
    Thanks in advance
    Luke.

    What is the color profile of the photo?
    LN

  • Line incomaptibilty betwwen RAW and CHAR data types in SAP Unicode System.

    Hi Gurus,
    I am working in SAP Unicode system.
    We have transferred the standard programs for Non-Unicode to Unicode system.
    In one standard function module, <table name> is defined in TABLES parameter as a type of TLINE structure, which has two fields - one is 132 length CHAR and other is 2 length CHAR.
    In the same function module , one subroutine is being called, for which <table name>  is passed.
    But in the FORM of subroutine, this table is defined as a type of HLINE, which has only one field - 134 length RAW data type.
    So due to confilct in data types ( CHAR and RAW ) , I am getting an error that both data types are not line compatible.
    Do i need to use casting concept to remove the error.
    Please suggest me the way to handle this.

    hi,
    declare the table as same data type.
    dont go for any other types.
    if you still want the form table as HLINE, then before the form call declare a varibale with TLINE data type pass the values to HLINE.
    i think this will be little complex, because again it will be type incompatablity.
    we can forcefully pass the values to HLINE with a class.
    but i think no need, declaring with same data type might be easy.
    Thanks
    Vinod

  • Use same report to print out different data sources on the fly.

    Post Author: Lady101
    CA Forum: Data Connectivity and SQL
    We have 10 reports use diferent datasource( use views with different joint tables), but their print out format are identical. Is there a way to just use single report to run those 10 reports dynamically(the report can point to the right data source on the fly)? So that we can just change single report format when report format needs to be changed. Right now we have to change 10 reports format one by one.

    Another option would be to make a single pass in the Source Monitor and save a bunch of subclips. Here's a thread discussing keyboard workflows: Re: Question on making many Subclips in a fast way
    If you name highlights with one base name and lowlights with another, it would be easy to drop each batch into its own sequence.

Maybe you are looking for

  • "Copy Command Desupport"

    Heard that "Copy Command will be obsolete in coming Oracle versions . Any idea , quick answers will be really appriciated.

  • Remove Items from "Open With" Menu

    I installed Photoshop CS2 last week and it added a ton of unnecessary and unwanted items in the "Open With" menu in Tiger... Sorry that image is so large, but imagine having to look at that on a regular basis. Can I remove all of that crap?! It's slo

  • Managed recovery vs dataguard

    I see some posts the they are not using dataguard and just managed recovery. Could someone let me know what is the difference?. I know only physical / logical standby database (dataguard) and also streams replication.

  • After update iphone says syncing but doesn't sync

    Hi. I just updated to the the new itunes.  Now I cannot sync any music to my iphone (4s).  It says syncing but no music shows up on phone.  I have tried to drag songs over to iphone list on right had side, but no luck.  I have tried starting in airpl

  • Why can't I see Apps in the Home Shared section?

    I have an iPhone. My husband has an iPad and an iPod.  We have two separate iTunes accounts. Both are running Windows 7. I have enabled Home Sharing on both computers. As a result, I can see my husband's Music, movies, TV shows, books, and playlists.