Examples

Examples

Reverse a Number

Find Largest Element of an Array

Print an Integer (Entered by the User)

Check Whether a Number is Even or Odd [if-else & ternary]

Convert Binary Number to Octal and vice-versa

Count the Number of Vowels and Consonants in a Sentence

Display Fibonacci Series

Swap Two Numbers

Check Whether a Number is Positive or Negative

Find LCM of two Numbers

Check Whether an Alphabet is Vowel or Consonant [if-else & switch-case]

Compute Quotient and Remainder

Find ASCII Value of a character

Convert Binary Number to Decimal and vice-versa

Multiply two Floating Point Numbers

Calculate Standard Deviation

Calculate Average Using Arrays

Check Whether a Number can be Expressed as Sum of Two Prime Numbers

Compare strings

Convert inputstream to string

Find the largest among three numbers [if-else & nested if-else]

Create random strings

Convert int type variables to string

Convert int type variables to char

Capitalize the first character of each word in a string

Iterate over an arraylist

Clear the stringbuffer

Add two dates

Convert a list to array and vice versa

Get current working directory

Create string from contents of a file

Display alphabets (a to z) using loop

Convert int type variables to long

Print an array

Convert character to string and vice-versa

Calculate difference between two time periods

Iterate over a hashmap

Check if a set is the subset of another set

Print object of a class

Add two complex numbers by passing class to a function

Generate multiplication table

Count number of digits in an integer

Find gcd of two numbers

Display factors of a number

Display armstrong numbers between intervals using function

Add two matrix using multi-dimensional arrays

Check if a string/number is palindrome

Display prime numbers between two intervals

Convert octal number to decimal and vice-versa

Display prime numbers between intervals using function

Reverse a sentence using recursion

Check armstrong number

Find the frequency of character in a string

Multiply two matrices by passing matrix to a function

Multiply two matrix using multi-dimensional arrays

Display armstrong number between two intervals

Calculate the power using recursion

Find factorial of a number

Check leap year

Check whether a character is alphabet or not

Calculate the sum of natural numbers

Calculate the power of a number

Check whether a number is prime or not

Find all roots of a quadratic equation

Make a simple calculator using switch...case

Find factorial of a number using recursion

Find g.c.d using recursion

Add two integers

Find transpose of a matrix

Find the sum of natural numbers using recursion

Calculate the execution time of methods

Implement binary tree data structure

Convert file to byte array and vice-versa

Compute all the permutations of the string

Delete file

Iterate over a set

Check if a string is numeric

Remove duplicate elements from arraylist

Convert string to date

Convert string type variables into boolean

Append text to an existing file

Sort map by keys

Call one constructor from another

Convert double type variables to int

Get the middle element of linkedlist in a single iteration

Check if a string is a valid shuffle of two distinct strings

Convert double type variables to string

Implement linkedlist

Access private members of a class

Convert primitive types to objects and vice versa

Get the file extension

Implement quick sort algorithm

Differentiate string == operator and equals() method

Get the relative path from two absolute paths

Calculate the difference between two sets

Convert map (hashmap) to list

Convert boolean variables into string

Implement merge sort algorithm

Create an enum class

Access elements from a linkedlist

Determine the class of an object

Add elements to a linkedlist

Remove elements from the linkedlist

Check if two of three boolean variables are true

Convert a stack trace to a string

Convert a string into the inputstream

Remove all whitespaces from a string

Concatenate two arrays

Convert byte array to hexadecimal

Convert char type variables to int

Convert milliseconds to minutes and seconds

Convert string type variables into int

Count number of leaf nodes in a tree

Create custom exception

Create pyramid and pattern

Count number of lines present in the file

Get current date/time

Determine the name and version of the operating system

Get the name of the file from the absolute path

Implement binary search algorithm

Iterate through each characters of the string

Load file as inputstream

Join two lists

Check if a string contains a substring

Merge two lists

Pass lambda expression as a method argument

Convert outputstream to string

Implement the queue data structure

Check if two strings are anagram

Pass arraylist as the function argument

Read the content of a file line by line

Calculate the intersection of two sets

Check if a string is empty or null

Iterate over enum

Convert long type variables into int

Delete empty and non-empty directory

Lookup enum by string value

Perform the postorder tree traversal

Update value of hashmap using key

Sort elements in lexicographical order (dictionary order)

Sort a map by values

Round a number to n decimal places

Implement multiple inheritance

Convert the arraylist into a string and vice versa

Calculate union of two sets

Implement the graph data structure

Convert array to set (hashset) and vice-versa

Get key from hashmap using the value

Check the birthday and print happy birthday message

Detect loop in a linkedlist

Implement private constructors

Convert the inputstream into byte array

Iterate over arraylist using lambda expression

Convert the linkedlist into an array and vice versa

Sort arraylist of custom objects by property

Convert int type variables to double

Implement bubble sort algorithm

Create an immutable class

Calculate simple interest and compound interest

Convert string variables to double

Check if an array contains a given value

Perform the inorder tree traversal

Create file and write to the file

Implement stack data structure

Perform the preorder tree traversal

Implement switch statement on strings

Pass method call as arguments to another method