Practice Core Java Basics in Java
Learn fundamental Java concepts including variables, data types, operators, and basic I/O operations.
Work through 26 exercises with starter code, expected output, test cases, and hints.
Core Java Basics exercises
- Declare Variables Java exercise — Declare and print different variable types
- Swap Two Values Java exercise — Swap the values of two variables
- Type Casting Java exercise — Convert between different data types
- Arithmetic Operations Java exercise — Perform basic math operations
- String Concatenation Java exercise — Combine strings together
- Modulus Operator Java exercise — Use modulus to get remainder
- Sum of Digits Java exercise — Calculate the sum of all digits in a number
- Reverse a Number Java exercise — Reverse the digits of an integer
- Count Digits Java exercise — Count the number of digits in an integer
- Calculate Power Java exercise — Calculate base raised to exponent without Math.pow
- Calculate Factorial Java exercise — Calculate factorial of a number
- Palindrome Number Check Java exercise — Check if a number is a palindrome
- Greatest Common Divisor Java exercise — Find GCD of two numbers
- Least Common Multiple Java exercise — Find LCM of two numbers
- Armstrong Number Check Java exercise — Check if a number is an Armstrong number
- Perfect Number Check Java exercise — Check if a number is perfect
- Number to Words Java exercise — Convert a single digit to its English word
- Triangle Type Checker Java exercise — Determine if sides form a valid triangle and its type
- Happy Number Check Java exercise — Check if a number is a happy number
- Strong Number Check Java exercise — Check if a number is a strong number
- Automorphic Number Check Java exercise — Check if a number is automorphic
- Binary to Decimal Java exercise — Convert a binary string to its decimal equivalent
- Decimal to Binary Java exercise — Convert a decimal number to its binary representation
- Prime Factorization Java exercise — Find all prime factors of a number
- Harshad Number Check Java exercise — Check if a number is divisible by sum of its digits
- Neon Number Check Java exercise — Check if sum of digits of square equals the number
Browse the complete Java practice path · Open the online Java compiler