Home » Core Java

Core Java

Char to Int Java Example

1. Introduction This article will demonstrate the char to int Java conversion. In Java, char data type is single 16 bit unicode character and int data type is 32 bit signed two’s complement integer. To convert one data type to another, type casting is required. Type casting can be of two types: implicit type casting and explicit type casting. Since ...

Read More »

Array to String Java Example

1. Intro to Array in Java In java, arrays are a collection of similar types where type can be a String, Integer or an instance of a user defined class. int intArray[]; //declaring an array of integers intArray = new int[20]; // allocating memory to array As shown in above code snippet, we have declared intArray as an array of ...

Read More »

Java Array Length Example

In this post, we feature a comprehensive Java Array Length Example. The article talks about the length property of Arrays in Java and demonstrates its usage through some examples. 1. Introduction Arrays are one of the most versatile data structure found in the programming paradigm, be it any programming language. An array is a group of similar datatype variables and ...

Read More »

Reverse Array Java Example

ٌHow would you answer this question: how do you reverse an array in Java?  Well, there are multiple ways to solve this problem: Revere array in Place:You can reverse array by writing your own function, which loops through the array and swaps elements until the array is sorted. You can reverse an array by converting array to ArrayList and then ...

Read More »

Java Collections Tutorial

1. Introduction A collection is a group of objects and treated as a single unit. It is used to store, retrieve, and manipulate aggregate data. Java has provides a collection framework which contains interfaces, classes, and algorithms since version 1.2 and enhanced it over the time. Here are some enhancements: Major enhancement at version 5, including generic type.Added more interfaces ...

Read More »

Java Stack Example

1. Introduction A stack is a container of objects that are inserted and removed according to the last-in-first-out (LIFO) principle. In the stacks, only two operations are allowed-  push the item into the stackpop the item out of the stack. A stack is a limited access data structure. Elements can be added and removed from the stack only at the top.  push adds ...

Read More »

Initialize Array Java Example

In this article, we are going to see the initialize array Java Example. We will cover the following things in this article: What are Arrays in Java?Array TypeArray ElementsCreating an array variableAccessing array ElementsInitialize array Java Example 1. What are Arrays in Java In java programming language arrays are objects.Arrays can contain empty, one or more than one element in ...

Read More »

SQL Constraints Example

Welcome readers, in this tutorial, we will understand the different SQL Constraints that maintain the data integrity inside a database table. 1. Introduction SQL Constraints are the restrictions that help maintain the data integrity inside a database table. Constraints can be divided into column level (i.e. limiting only column data) or table level (i.e. limiting whole data in a database ...

Read More »

Java .class File Example

In this post, we feature a comprehensive article on Java .class File. Have you ever wondered: What is bytecode in Java? What makes Java a platform-independent language? What is the Java .class file?Structure of Java class file. In this article, we will address all the above questions and we will deep dive into understanding bytecode or .class file in Java ...

Read More »

Java Synchronized Blocks Example

In this post, we feature a comprehensive article on Java Synchronized Blocks. Java synchronized keyword marks a block or method a critical section. A critical section is where one and only one thread is executing at a time, and the thread holds the lock for the synchronized section. Java is multi-threaded language where multiple threads runs parallel to complete their ...

Read More »