- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is the difference between integer and floating point literals in Java?
Integer literals represent fixed integer values like 900, 12, 400, -222 etc. (with in the integer range).
Whereas, floating point literals represents fractional values i.e. numbers with decimal values like 25.53, 45.66, 58.66 etc. while writing these literals we should use the notation f or F as 25.53.
Example
public class StringExample { public static void main(String args[]){ int num1 = 100; float num2 = 30.0f; System.out.println("Value of integer:"+num1); System.out.println("Value of integer:"+num2); } }
Output
Value of integer:100 Value of integer:30.0
- Related Articles
- Integer literals vs Floating point literals in C#
- What is the difference between character literals and string literals in Java?
- What are floating point literals in C#?
- What is the difference between data types and literals in Java?
- What is the difference between floating currency and fixed currency?
- Floating point operators and associativity in Java
- What is the difference between int and integer in MySQL?
- Floating-point hexadecimal in Java
- Difference between an Integer and int in Java
- What are integer literals in C#?
- Define integer literals as octal values in Java
- Format floating point number in Java
- Floating-point conversion characters in Java
- What is the precision of floating point in C++?
- What is the difference between Point to Point Link and Star Topology Network?

Advertisements