📘 Premium Read: Access my best content on Medium member-only articles — deep dives into Java, Spring Boot, Microservices, backend architecture, interview preparation, career advice, and industry-standard best practices.
✅ Some premium posts are free to read — no account needed. Follow me on Medium to stay updated and support my writing.
🎓 Top 10 Udemy Courses (Huge Discount): Explore My Udemy Courses — Learn through real-time, project-based development.
▶️ Subscribe to My YouTube Channel (172K+ subscribers): Java Guides on YouTube
The Float wrapper class is used to represent float primitive variable as an object in Java.
float Java Keyword Examples
float <variable-name> = <float-value>;
float price = 19.95;
public float getBalance() {
return balanceAmount;
}
float f = 65.55;
Float fRef = f;
Remarks
- Floating point literals in Java always default to double−precision. To specify a single−precision literal value, follow the number with f or F, as in 0.01f.
- In Java, float keyword is used to store the 32 bit float primitive types.
- Java floating point numbers can represent infinity and NaN (not a number). The Float wrapper class defines the constants MIN_VALUE, MAX_VALUE, NEGATIVE_INFINITY, POSITIVE_INFINITY and NaN.
Comments
Post a Comment
Leave Comment