Skip to content

Java Basic Examples

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.

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.

Primitive values to String conversions

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

String to primitive values conversions

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

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.

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

Array Conversion Examples

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

About the author

Leave a Reply

Your email address will not be published.