SQL Practice
sqlpractice.co.in
Languages Learn Practice Playground Interview
Run code
Languages Learn Practice Playground Interview SQL Search
Home / Java / Practice

Java exercises

Exercises with full test sets for Java are being written and verified. Until they are published, every lesson ends with a short program to write, with its expected output.

  • Java Syntax and Your First ProgramWhat every Java program needs: a class, a main method, statements and semicolons. Compile and run a first program, read input, and avoid the usual setup errors.8 minCompleted
  • Variables and Data Types in JavaJava's primitive types and String, declaring and initialising variables, var, casting and integer overflow: why the type you pick decides what a value can hold.9 minCompleted
  • Operators in JavaJava's arithmetic, comparison, logical and assignment operators: integer division, remainder, short-circuit evaluation and precedence, with runnable examples.9 minCompleted
  • Conditions in Java: if, else and switchHow Java chooses between paths with if, else if and else, how the switch with arrows works, how to compare strings correctly and how to keep branches readable.9 minCompleted
  • Loops in Java: for, while and do-whileHow Java repeats work with for, while and do-while loops, when each fits, what break and continue do, and how to avoid off-by-one and infinite loops.9 minCompleted
  • Arrays in JavaHow Java arrays store a fixed number of values of one type: creating and indexing them, length, the for-each loop, java.util.Arrays helpers and 2D arrays.9 minCompleted
Exercises in other languagesJava lessons
SQL Practice

Free tutorials, exercises and browser-based playgrounds for SQL, Python, JavaScript and more. Every example was run before it was published; your code runs on your own device.

Learn

  • All languages
  • Learning paths
  • Free SQL course
  • SQL beginner's guide
  • SQL glossary
  • Interview preparation

Practice

  • All exercises
  • SQL exercises
  • Guided projects
  • Code playground
  • SQL playground
  • Search

Site

  • About
  • How we verify
  • Contact
  • Privacy Policy
  • Terms of Use
  • Open Source Licenses
  • Disclaimer
© 2026 SQL Practice. Your code runs locally in your browser. RSS feed