Using the # flag with conversion characters o and x. - Java Language Basics

Java examples for Language Basics:Number Format

Description

Using the # flag with conversion characters o and x.

Demo Code

public class Main 
{
   public static void main(String[] args)
   { /*from   ww w. j a va 2s  .c o  m*/
      int c = 31;      // initialize c 
   
      System.out.printf("%#o\n", c);
      System.out.printf("%#x\n", c);
   } 
}

Result


Related Tutorials