bugl
bugl
HomeLearnPatternsPathsSearchPremium
HomeLearnPatternsPaths
Learn/Java/Java How To's
Java•Java How To's

Java How To's

These examples show how to solve common tasks in Java.

Numbers

  • Add Two Numbers - Add two numbers and print the result.
  • Swap Two Variables - Exchange values between two variables.
  • Even or Odd Number - Check if a number is even or odd.
  • Reverse a Number - Reverse a number.
  • Positive or Negative - Check if a number is positive or negative.
  • Square Root - Find the square root of a number.
  • Area of Rectangle - Calculate the area of a rectangle.
  • Convert Celsius to Fahrenheit - Convert a temperature from Celsius to Fahrenheit.
  • Sum of Digits - Add up the digits of a number.
  • Armstrong Number - Check Armstrong number.
  • Random Number - Generate a random number.

Strings

  • Count Words - Count how many words are in a sentence.
  • Count Vowels in a String - Count how many vowels are in a string.
  • Remove Vowels from a String - Remove vowels from a string.
  • Count Digits in a String - Count digits in a string.
  • Reverse a String - Reverse the characters in a string.
  • Palindrome Check - Check if a string is the same forward and backward.
  • Check Anagram Strings - Check if two strings contain the same characters in different order.
  • Convert String to Array - Split a string into an array of words.
  • Remove Whitespace - Delete spaces, tabs, and newlines from a string.
  • Count Character Frequency - Count how many times each character appears in a string.

Arrays

  • Sum of Array Elements - Add all the elements in an array.
  • Find Array Average - Calculate the average value of array elements.
  • Sort an Array - Sort array elements.
  • Find Smallest Element - Find the lowest value in an array.
  • Find Largest Element - Find the largest value in an array.
  • Second Largest Array - Find the second largest value in an array.
  • Min and Max in Array - Find the minimum and maximum value in an array.
  • Merge Two Arrays - Combine two arrays into one.
  • Remove Duplicates - Remove duplicates from an array using a Set.
  • Find Duplicates - Find duplicate elements in an array.
  • Shuffle an Array - Randomize the order of array elements.

Algorithms

  • Factorial of a Number - Find the factorial of a number.
  • Fibonacci Sequence - Print the first 10 Fibonacci numbers.
  • Find GCD - Find the Greatest Common Divisor (GCD).
  • Check Prime Number - Check if a number is prime.

Collections

  • ArrayList Loop - Loop through an ArrayList.
  • HashMap Loop - Loop through a HashMap.
  • Loop Through an Enum - Iterate over enum values.

Chapter

Back to Java How To's

Next

Java How To Add Two Numbers

This chapter

Overview
40

Lessons

80m

Read time

1. Java How To's2. Java How To Add Two Numbers3. Java How To Swap Two Variables4. Java How To Find Even or Odd Numbers5. Java How To Reverse a Number6. Java How To Find Positive or Negative Numbers7. Java How To Find the Square Root of a Number8. Java How To Get the Area of a Rectangle9. Java How To - Convert Celsius to Fahrenheit10. Java How To - Sum of Digits11. Java How To Check Armstrong Number12. Java How To Generate Random Numbers13. Java How To Count Words14. Java How To - Count Vowels in a String15. Java How To Remove Vowels from a String16. Java How To Count Digits in a String17. Java How To Reverse a String18. Java How To - Palindrome Check19. Java How To Check Anagram Strings20. Java How To Convert a String to an Array21. Java How To - Remove Whitespace from a String22. Java How To - Character Frequency in a String23. Java How To Calculate the Sum of Elements24. Java How To Find the Average of Array Elements25. Java How To Sort an Array26. Java How To - Smallest Element in an Array27. Java How To - Largest Element in an Array28. Java How To - Second Largest Array Element29. Java How To Find Min and Max in Array30. Java How To - Merge Two Arrays31. Java How To - Remove Duplicates from an Array32. Java How To Find Duplicates in an Array33. Java How To - Shuffle an Array34. Java How To - Calculate Factorial of a Number35. Java How To - Fibonacci Sequence36. Java How To Find the GCD37. Java How To - Check if a Number Is Prime38. Java How To Loop Through an ArrayList39. Java How To Loop Through a HashMap40. Java How To Loop Through an Enum

On this page

NumbersStringsArraysAlgorithmsCollections