Home » Core Java (page 4)

Core Java

Java char Primitive Type Example

1. What are Primitive Types in Java? The Java programming language is statically-typed, which means that all variables must first be declared before they can be used. This involves stating the variable’s type and name, as you’ve already seen: char gear = '1'; Above code tell the Java Compiler that a field named “gear” exists, holds character data, and has ...

Read More »

Java Extends Keyword Example

Hello readers, in this tutorial, we will learn the Java extends keyword. 1. Introduction In Java, a subclass can extend the properties of its parent class by using the extends keyword. In Java, java.lang.Object is the parent class of all classes. Do note, this is implicit and does not require to be specified explicitly A class can only extend a ...

Read More »

Java CSV Parsing Example

In this post, we feature a comprehensive Java CSV Parsing Example. CSV stands for Comma Separated Values. As Java developers, we frequently see the need to process CSV files. They are the most commonly used file format for the data interchange. CSV is the simple file format that organizes data in a tabular form and each value is delimited by ...

Read More »

Java Input Example

This article will feature a comprehensive Example on Java Input. We will look into various ways of obtaining user input in Java with relevant code examples. 1. Introduction User Input refers to the data that is sent to computer application for processing using an input device like keyboard. Computer application receives the keyboard device input in the form of an ...

Read More »

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 »