.java. Use Settings to adjust font size and tab width to your preference.Note: stdin (Scanner) support is available — add your input in the input field before running.
Click any snippet to load it into the editor.
public class Main {
public static void main(String[] args) {
for (int i = 1; i <= 10; i++) {
System.out.println("Number: " + i);
}
}
}
A basic for loop. Change the upper bound and click Run to see the updated output instantly.
public class Main {
static int square(int n) {
return n * n;
}
public static void main(String[] args) {
System.out.println("Square of 5: " + square(5));
System.out.println("Square of 9: " + square(9));
}
}
Demonstrates defining and calling a static method. Great for practicing method signatures and return types.
import java.util.ArrayList;
public class Main {
public static void main(String[] args) {
ArrayList<String> fruits = new ArrayList<>();
fruits.add("Apple");
fruits.add("Banana");
fruits.add("Mango");
for (String fruit : fruits) {
System.out.println(fruit);
}
}
}
Shows how to use ArrayList and the enhanced for-each loop — common exam and interview topics.
Practising Java assignments, debugging homework, or preparing for exams — no IDE setup needed on a school computer.
Quickly prototyping a snippet, testing a method's behaviour, or sharing a reproducible example with a colleague via link.
Embedding runnable code examples in lesson notes or sharing pre-written programs for students to modify and run live in class.