Java basic examples will help you get started with very basic concepts of the Java programming language. These basic Java programs will help you understand the concepts in the form of simple programs with output and make your learning process faster.

- How to swap two numbers with third variable and without third variable
- How to calculate Fibonacci series in Java
- How to calculate factorial of a number in Java
- How to check if a number is a prime number in Java
- How to check if String is a palindrome in Java
- Example Student class
- Example Employee class

## Wrapper objects to primitive conversions

Wrapper classes in Java are wrappers around the primitive data types. There are total 8 primitive types in Java namely byte, short, int, long, float, double, char, and boolean. The corresponding wrapper class for them are Byte, Short, Integer, Long, Float, Double, Character, and Boolean respectively. We need to use these classes instead of primitive values when we work with a generic class, as they work with objects.

- Convert primitive to wrapper objects
- Convert String to wrapper objects
- Convert Byte object to primitive types
- Convert Short object to primitive types
- Convert Integer object to primitive types
- Convert Long object to primitive types
- Convert Float object to primitive types
- Convert Double object to primitive types

## Primitive values to String conversions

Below given examples will show you how to convert Java primitive values to a String object.

- Convert any primitive type to String
- Convert int to String
- Convert long to String
- Convert float to String
- Convert double to String
- Convert byte to String
- Convert short to String
- Convert boolean to String
- Convert char to String

## String to primitive values conversions

Below given examples will show you how to convert String object to Java primitive values.

- Convert String to any primitive
- Convert String to byte
- Convert String to short
- Convert String to int
- Convert String long
- Convert String to float
- Convert String to double

## Java Math Examples

Java Math class is a utility class provided by Java to perform mathematical calculations. The Math class in Java contains various methods to calculate the logarithm, rounding numbers, generating random numbers, etc.

- How to generate random number using random method of Java Math class
- How to calculate logarithm value using log method of Java Math class
- How to find exponential using pow method of Java Math class
- How to find minimum number using min method of Java Math class
- How to find maximum number using max method of Java Math class
- How to round a number using round method of Java Math class
- How to round down a number using floor method of Java Math class
- How to round up a number using ceil method of Java Math class
- How to find absolute value of a number using abs method of Java Math class

## Java Array Examples

An Array in Java is a collection of elements of the same type. The array is the most basic data structure provided by Java to store the elements.

### Array Basic Examples

- Get array length example
- How to print array elements in Java
- How to define and use Java String array
- How to find element index in array like indexOf method
- Join two arrays
- Reverse array example
- How to create ArrayList containing arrays
- How to add arrays to ArrayList
- How to initialize String array
- Remove duplicate elements from String array
- How to find duplicate elements in an int array
- How to check if array contains value or element
- Sort String[] array example
- Sort String[] array containing numbers

### Array Conversion Examples

Below given array conversion examples will show you how to convert array to other types, and vice versa.

- Convert array to ArrayList
- Convert ArrayList to array
- Convert ArrayList to String array
- Convert array to HashSet
- Convert HashSet to array
- Convert int array to String
- Convert byte array to String
- Convert String to byte array
- Convert String to String[] array
- Convert String[] array to String
- Convert List to array
- Convert String to character array or char array
- Convert String array to ArrayList

## Add Comment