Difference between ArrayList and LinkedList in Java

Here you will learn about difference between arraylist and linkedlist in java i.e. arraylist vs linkedlist. Both ArrayList and LinkedList are similar in many ways like both implement List interface and are non-synchronized. But still there are various differences between them which I have discussed below. Also Read: Difference between ArrayList and Vector in Java Image Source Difference between ArrayList and LinkedList in Java ArrayList LinkedList Implementation ArrayList internally implements dynamic array to store elements. LinkedList internally implements doubly linked list

Read more

Java Program to Find Largest Number in Array Using Recursion

Here you will get java program to find largest number in array using recursion.

Output Given Array: 5 12 10 6 15 Largest Number is 15 Comment below if you have any queries regarding above program.

Read more

Java Program to Find Inverse of a Matrix

Here you will get java program to find inverse of a matrix of order 2×2 and 3×3. We can find inverse of a matrix in following way. First find the determinant of matrix. Calculate adjoint of matrix. Finally divide adjoint of matrix by determinant. Image Source Below I have shared program to find inverse of 2×2 and 3×3 matrix. Java Program to Find Inverse of a Matrix 2×2 Matrix

Output Enter elements of matrix row wise: 4 7 2

Read more

Bucket Sort in Java

Here you will learn about bucket sort in Java with program example. Bucket Sort is a sorting algorithm in which elements of given array are distributed into different buckets and then each bucket is sorted individually using some other sorting technique or recursively using bucket sort. An example is shown in following images. Program for Bucket Sort in Java Here in this program I have assumed that array elements are positive and less than 10.

Output Before sorting: 3

Read more

Solve Cannot make a static reference to the non-static method Error

Here you will learn to solve error “cannot make a static reference to the non-static method” or “non static method cannot be referenced from a static context”. Lets take one example where this error occurs. When you will compile below code then you will get an error.

Why this Error Occurs? This error occurs when we try to access a non static method or member directly inside a static method. In above code print() is a non static method

Read more

Java Read and Write Excel File Using Apache POI

Apache POI provides libraries for reading and writing excel file in Java. There are other libraries available in market but Apache POI is most popular and reliable among them. In this tutorial I will show you how you can read or write data to excel file in Java using Apache POI Library. There are few things that you should know about this library. Class prefixed by HSSF are used to perform operations on MS Excel 2003 file. For example, HSSFWorkbook and

Read more

JDBC Transaction Management in Java with Example

Here you will learn to implement JDBC transaction management in java. By default database is in auto commit mode. That means for any insert, update or delete operation the changes takes place immediately in database. What is Transaction? Transaction involves several sql queries that are considered as one unit. For example money transfer done in bank is a kind of transaction as it involves two steps. First debit the x amount of money from source account and then credit that

Read more

Advantages and Disadvantages of Java Language

Here I will discuss about some important advantages and disadvantages of Java language. Advantages of Java There are several advantages or merits of java that are explained below. Platform Independent It is one of the biggest merit of java language. When a java program is compiled it is converted into .class file or byte code. The .class file is platform independent and can run on any platform like windows, mac, linux, etc. This property is known as Write Once Run

Read more
1 2 3 10