

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Integral conversion characters in Java
Intergral conversion characters include the following.
Character | Description |
---|---|
%d | Integer |
%o | Octal |
%x | Hexadecimal |
%X | Hexadecimal |
Example
public class Demo { public static void main(String[] args) throws Exception { System.out.printf( "Integer: %d\n", 889 ); System.out.printf( "Negative Integer: %d\n", -78 ); System.out.printf( "Octal: %o\n", 677 ); System.out.printf( "Hexadecimal: %x\n", 56 ); System.out.printf( "Hexadecimal: %X\n", 99 ); } }
Output
Integer: 889 Negative Integer: -78 Octal: 1245 Hexadecimal: 38 Hexadecimal: 63
- Related Questions & Answers
- Floating-point conversion characters in Java
- Conversion characters for date in Java
- Conversion characters for time in Java
- Narrowing Conversion in Java
- What are printf conversion characters and their types?
- Widening Primitive Conversion in Java
- Data Conversion Using valueOf() In Java.
- What is type conversion in java?
- Conversion of Array To ArrayList in Java
- Conversion of Set To Stream in Java
- Conversion of Stream To Set in Java
- Conversion of Java Maps to List
- Trapezoidal Rule for definite integral
- Different ways for Integer to String conversion in Java
- Conversion Functions in SQL
Advertisements