
- 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
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 Questions & Answers
- Integer literals vs Floating point literals in C#
- What are floating point literals in C#?
- What is the difference between character literals and string literals in Java?
- What is the difference between data types and literals in Java?
- What is the difference between Point to Point Link and Star Topology Network?
- What is the difference between int and integer in MySQL?
- Floating point operators and associativity in Java
- What is the precision of floating point in C++?
- Floating-point hexadecimal in Java
- What is Floating-Point Representation in Computer Architecture?
- Fixed Point and Floating Point Number Representations
- Floating-point conversion characters in Java
- Format floating point number in Java
- Difference between Point-to-Point and Multi-point Communication
- What is the difference between Java and Core Java?
Advertisements