How To Create An Array In Java

How To Create An Array In Java

In java, arrays are li'l bit different then C/C++. But the basic concept is same. Here, i am going to describe Java Arrays with small examples just to understand the concept. If you are a beginner and looking for your head start with arrays then this article might be good start for you as well. Let us now dive right into the concept - What is an Array? Array is a data structure that can be used to store fixed number of multiple values of similar data type. They are fixed in length. We have to specify the size of an array at the time of the initia...

Continue Reading...

How To Sort List In Java With Examples

How To Sort List In Java With Examples

There are two ways to sort list in java - Sort list of String/Wrapper Class (Using Default Soring) Sort list of User-Defined Class (Using Custom Soring) Sort list of String/Wrapper Class A list of String/Wrapper Class (Integer, Long, Byte, Double, Float, Short) can be sorted using utility class Collections present in java.util package. This class contains a static method sort(List<T> list) that takes a list and sorts it into ascending order...

Continue Reading...

How To Read And Write Properties File In Java

How To Read And Write Properties File In Java

Let's try to understand properties files with examples -  Properties files are just plain text files with .properties extension. You can store data in these files only in key/value pairs. These files are mainly used to store configuration details for a java application. For example, you can store database url, username and password to this file and then use this file to get database configuration at runtime. The main advantage of this approach that you can change your database any time you want by just changing the...

Continue Reading...

Primitive Data Types In Java With Examples

Primitive Data Types In Java With Examples

There are total 8 primitive data types available in Java –  Numeric Data types These datatypes are used to represent numbers  Integer Data types These data types are used to represent Whole Numbers like 2, 23, 435, 454367 etc. 1.    byte This data type is suitable if you want to handle your data in the form of streams either from file or from the network. The range of this datatype is -128 to +127. So, the maximum possible value for a variable of a byte is 127 and the minimum valu...

Continue Reading...