Browse by Topic

Popular

Latest

Latest Java Posts

Illustration of a string being converted to a double value in Java, with a warning symbol for invalid input.
Java

Java Double.parseDouble: Parsing Strings to Doubles

See how to use Double.parseDouble to convert strings to primitive doubles, handle invalid input and locale-specific numbers, and choose between parseDouble and valueOf.

Double parsingNumberFormatExceptionJava string conversionDouble.valueOf
Java string to double conversion concept with a digital representation of parsing a text value into a numeric type.
Java

Convert a Java String to Double: Syntax and Pitfalls

How to convert a Java string to double using Double.parseDouble and Double.valueOf, including NumberFormatException handling and locale-related pitfalls.

Double.parseDoubleNumberFormatExceptionLocaleType Conversion
Diagram comparing Integer.parseInt returning a primitive int and Integer.valueOf returning a cached Integer object in Java.
Java

Java parseInt vs valueOf: Which Integer Conversion to Use

Compare Java's Integer.parseInt and Integer.valueOf: primitive vs wrapper return types, caching behavior, autoboxing effects, and when to use each method.

JavaIntegerString ParsingAutoboxing
Illustration of Integer.valueOf returning a cached object from a small pool, with a magnifying glass over the range -128 to 127.
Java

Java Integer.valueOf: Caching and Usage Explained

Understand Java's Integer.valueOf() method: its caching behavior, differences from parseInt, and when to use it for efficient and correct code.

IntegervalueOfautoboxingJava caching
Illustration of a string being converted into an integer using Java's Integer.parseInt method, with a magnifying glass highlighting the parsing process.
Java

Java Integer parseInt: Parsing Strings to Integers

A practical guide to Java's Integer.parseInt: syntax, NumberFormatException handling, radix parsing, and the difference from Integer.valueOf.

Integer.parseIntNumberFormatExceptionJava string parsingradix conversion
Illustration of converting a string to an integer in Java with error handling.
Java

Java String to int: Parse and Handle Errors

java string to int: Convert a Java String to int using parseInt and valueOf, handle invalid input, and avoid common pitfalls with practical examples.

JavaString parsingNumberFormatExceptionInteger
Diagram showing Java int to String conversion methods with code snippets
Java

Java int to String: Choosing the Right Conversion Method

Learn the differences between Integer.toString, String.valueOf, and concatenation for converting int to String in Java, including edge cases and performance.

JavaString ConversionIntegerJava Basics
Editorial diagram showing a decimal value being truncated and rounded into two integer containers on a Java-themed background.
Java

Java Double to Int: Cast, Round, and Overflow

Converting a double to an int in Java: learn how the direct cast truncates, how Math.round rounds, how overflow and NaN behave, and when each approach fits.

javatype-conversionnumeric-castingmath-round
Diagram showing an integer value widening into a double-precision floating-point number with a cast operator
Java

Java int to double: Conversion Rules and Precision

java int to double: Learn how Java converts int to double through widening conversion, when explicit casting is required, and where precision can be lost in arithmetic.

JavaType ConversionWidening ConversionFloating Point
Diagram illustrating widening and narrowing conversions between Java primitive types
Java

Java Widening vs Narrowing Conversion

Learn the difference between Java widening and narrowing conversions: implicit vs. explicit casting, precision-loss risks, constant-expression narrowing, and practical examples.

Javatype conversioncastingprimitive types