๐ 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.
๐ Top 15 Udemy Courses (80-90% Discount): My Udemy Courses - Ramesh Fadatare — All my Udemy courses are real-time and project oriented courses.
▶️ Subscribe to My YouTube Channel (176K+ subscribers): Java Guides on YouTube
▶️ For AI, ChatGPT, Web, Tech, and Generative AI, subscribe to another channel: Ramesh Fadatare 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