How to Add or Import Jar in Eclipse Project

In this tutorial I will show you the simplest way to add or import jar in your eclipse project.   How to Add or Import Jar in Eclipse Project 1. First of all copy all the jars that you want to import.   2. Now paste them inside lib folder of your project. Web Project: For web project you can find the lib folder inside YourProjectFolder > WebContent > WEB-INF > lib. If it is not present there just create lib

Read more

Bubble Sort in Java

In this tutorial you will learn about bubble sort in Java. In bubble sort algorithm each element is compared with adjacent element and are swapped if not in correct order. It is one of the simplest but worst sorting algorithm. It is suitable for sorting small list of numbers. As bubbles come up on surface in water, in the same way the lighter or smaller elements come forward and heavier or bigger elements goes back. Below image shows how bubble

Read more

Difference between Array and ArrayList in Java

Here you will learn about difference between array and arraylist in java. Both array and arraylist are most important and frequently used data structure in java. Below I have discussed about various differences between them.   Difference between Array and ArrayList in Java Property Array ArrayList Size Array is fixed in size. Once declared, its size can’t be changed. ArrayList size can be changed after declaration. For example when we add or remove element in arraylist, its size increases or

Read more

How to Split String in Java with Example

Here you will learn how to split string in java. We can split string in Java using split() method of java.lang.String class. It takes a regular expression as an argument and returns an array of strings. Syntax:

  Split String in Java Example Below program will split the string by space.

  Output I Love Java Programming   There are few special characters like ., ?, |, +, etc. and some escape characters like \n, \t, \b, etc.

Read more

Why Java Does Not Support Pointers?

Below are some reasons why Java does not support pointers. Although there are various advantages of pointer but it has several disadvantages that I have mentioned in the article.     Simple The pointer concept is very confusing, difficult to understand (especially for beginners) and causes bugs in code. To make java simpler and less complex the java creators decided to remove the concept of pointers.   Secure Security is one of the biggest issue in programming world. Pointer provides

Read more

Binary Search in Java

In this tutorial you will learn about binary search in Java. Binary search is a searching algorithm that uses divide and conquer technique. The array on which searching is to be done must be sorted in ascending order. The target element is compared with middle element. If it is less than middle element then left half is discarded and if it is greater than middle element then right half is discarded. Now a new middle element is calculated in the remaining

Read more

Java Virtual Machine (JVM) Architecture

In this tutorial you will learn about Java Virtual Machine (JVM) architecture. What is JVM? Java Virtual Machine (JVM) is software or a virtual machine that takes .class file as an input and runs java bytecode. Java is machine independent but JVM is machine dependent.   What is Bytecode? When java program is compiled using javac compiler, it is converted into intermediate code known as bytecode. The byte code is stored in .class file. Bytecode contains special instructions that are

Read more

Comparable vs Comparator in Java

Here you will learn about Comparable vs Comparator in Java. Difference between Comparable and Comparator is one of the commonly asked questions in Java interviews. Both the interfaces are used to sort collection objects but still there are some differences between them which I have discussed below. Also Read: Comparable and Comparator Example Comparable vs Comparator in Java S.No Comparable Comparator 1. It is used to sort objects on the basis of only one property at a time. For example if

Read more
1 13 14 15 16