Results 1 to 4 of 4
  1. #1
    xjader is offline Member
    Join Date
    Oct 2013
    Posts
    4
    Rep Power
    0

    Default Printf Hexdecimal Value

    Hi,

    I am trying to print out:
    Copyright sign: © 169 A9

    I am not sure what to write afterward.
    char copyrightSign = '\u00a9';
    System.out.printf("\ncopyrightSign: %c...."

  2. #2
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    3,618
    Rep Power
    5

    Default Re: Printf Hexdecimal Value

    Your printf syntax is incorrect. It is System.out.printf("Format string", variables,....);

    Regards,
    Jim
    The Java™ Tutorial | SSCCE | Java Naming Conventions
    Poor planning our your part does not constitute an emergency on my part.

  3. #3
    xjader is offline Member
    Join Date
    Oct 2013
    Posts
    4
    Rep Power
    0

    Default Re: Printf Hexdecimal Value

    I know printf is wrong. I am not sure what to put in the printf. I know my printf is incorrect.
    char copyrightSign = '\u00a9';
    int copyrightSignNumber = (int) ch;
    System.out.printf("\ncopyrightSign: %c copyrightSignNumber: %d, copyrightSignHex %02x%n", Copyright Sign);

  4. #4
    xjader is offline Member
    Join Date
    Oct 2013
    Posts
    4
    Rep Power
    0

    Default Re: Printf Hexdecimal Value

    nvm I figured it out myself....
    Fking java
    char CopyrightSign = '\u00A9';
    int CopyrightSignNumber = (int) CopyrightSign;
    System.out.printf("\nCopyright Sign: %c %d %02x%n", CopyrightSign, CopyrightSignNumber, CopyrightSignNumber);

Similar Threads

  1. Using printf to pad spaces
    By hamster in forum New To Java
    Replies: 2
    Last Post: 05-06-2012, 05:01 PM
  2. Replies: 9
    Last Post: 04-06-2012, 08:53 PM
  3. printf VS printWriter.printf
    By Mapisto in forum New To Java
    Replies: 14
    Last Post: 01-20-2012, 12:29 PM
  4. printf
    By razzle in forum New To Java
    Replies: 4
    Last Post: 11-12-2010, 02:13 PM
  5. printf
    By Jack in forum New To Java
    Replies: 2
    Last Post: 07-04-2007, 04:31 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •