Write a method that takes a sentence and reverses each word without changing their order.
Example: Java is fun
→ avaJ si nuf
Write a program that counts how many times each character appears in a string.
Example: banana
→ Output: {b=1, a=3, n=2}
Write your own method to sort an integer array in ascending order (e.g., using bubble sort).
Given an integer array, return all duplicate elements.
Example: [1, 2, 3, 2, 4, 5, 1]
→ Output: [1, 2]
Write a method to check whether two strings are anagrams (e.g., listen
and silent
).
Create a class BankAccount
with:
accountNumber
, balance
deposit()
, withdraw()
, getBalance()
Write a program that:
An Armstrong number is one where the sum of its digits raised to the power of number of digits equals the number.
Example: 153
→ Output: true
(1³ + 5³ + 3³ = 153)
Create an Employee
class and an ArrayList<Employee>
to store employees. Add methods to:
Write a program to: