Pages

Topics

Tools

↑↓navigate↵openescclose

All syntax guides

Short, practical guides on programming syntax, language fundamentals, and the tools developers reach for every day.

3,980 guides across 14 topics

Topics

Latest guides

Diagram showing an integer value 65 becoming the character 'A' with an arrow, highlighting the Java int to char cast.
Java

Java int to char: Conversion and Pitfalls

java int to char: Java int to char conversion involves direct casting, which interprets the int as a Unicode code point. Understand behavior, pitfalls, and when to use...

type conversioncharintegerUnicode
Diagram showing a Java char '7' converting to an integer 7 with a highlighted path, avoiding the ASCII value 55.
Java

Convert java char to int

Learn how to convert a Java char to an int, including digit-value extraction, Unicode behavior, and common pitfalls.

Java conversionASCII valuesnumeric parsingCharacter API
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