Java code examples · runnable

20 runnable Java code examples.

Open any Java example to explore the code and run it online. No setup, no signup.

Java

How to convert a string to an int in JavaHow to iterate over a map in JavaHow to convert an array to a list in JavaHow to generate a random number in a range in JavaHow to check if an array contains a value in JavaHow to initialize a list in one line in JavaHow to declare and initialize an array in JavaHow to print an array in JavaHow to convert a string to an enum in JavaHow to break out of nested loops in JavaHow to split a string in JavaHow to sort a Map by value in JavaHow to read a file into a String in JavaHow to round to 2 decimal places in JavaHow to concatenate two lists in JavaHow to sort a list of objects by property in JavaHow to compare strings in JavaHow to join a list into a string in JavaHow to remove items from a list while iterating in JavaHow to get the current date and time in Java
Questions & answers

Examples, explained

Yes. Open any Java example to edit and run its code on the CompileBytes engine without installing anything.