bugl
bugl
HomeLearnPatternsPathsSearchPremium
HomeLearnPatternsPaths

Loading lesson path

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.

Next

Java How To Add Two Numbers