Java reference

Java methods, syntax, and runnable examples

Search commonly used Java methods and language features, check return types, copy examples, and send selected code directly to the compiler.

Results

String Methods

toCharArray()

Converts the string into a new character array.

Best use

Use this entry when you need the syntax, return type, and a runnable example quickly.

Syntax

char[] toCharArray()

Return type

char[]

Java example

String str = "Hello";
char[] chars = str.toCharArray();
for (char c : chars) {
    System.out.println(c);
}

Advertisement

Java APIs and syntax covered

The reference covers frequently used Java language features and standard-library APIs. Each entry includes a concise explanation, syntax, and an example intended for quick lookup while coding.

String Methods

21 entries

Scanner Methods

9 entries

File Methods

9 entries

Exception Handling

6 entries

Number Methods

8 entries

Math Methods

8 entries

ArrayList Methods

9 entries

HashMap Methods

9 entries

Related Java guides and tools