Algorithm for sorting images by its date using Files

1.Create a file object and pass the location path of the folder in the argument. 2.Access all the files contained in the specified folder using listFiles() and it returns a file Array .Store that file Array in new file array reference. 3.Seperate the image files from the folder. check all the files ending with jpgContinue reading “Algorithm for sorting images by its date using Files”

Map Interface and list interface

Map Interface public interface Map<K,V> A map contains values on the basis of key, i.e. key and value pair. Each key and value pair is known as an entry. A Map contains unique keys. Map is useful, when we have to search, update and delete values based on keys. An object that maps keys toContinue reading “Map Interface and list interface”

Collection in Java 

 Collection in Java is a framework that provides an architecture to store and manipulate the group of objects. Java Collections can achieve all the operations that you perform on a data such as searching, sorting, insertion, manipulation, and deletion. Java Collection means a single unit of objects. Java Collection framework provides many interfaces (Set, List, Queue,Continue reading “Collection in Java “

java.util.Arrays

This class is a member of the java collection framework. This class contains various methods for manipulating arrays (such as sorting and searching). This class also contains a static factory that allows arrays to be viewed as lists(to be discussed). The methods in this class all throw a NullPointerException, if the specified array reference is null, exceptContinue reading “java.util.Arrays”

Garbage collection

In C/C++, programmer is responsible for both creation and destruction of objects. Usually programmer neglects destruction of useless objects. Due to this negligence, at certain point, for creation of new objects, sufficient memory may not be available and entire program will terminate abnormally causing OutOfMemoryErrors. But in Java, the programmer need not to care for allContinue reading “Garbage collection”

Exception handling

The Exception Handling in Java is one of the powerful mechanism to handle the runtime errors so that normal flow of the application can be maintained. Exception is an abnormal condition as per dictionary meaning. In java, an exception is an event that disrupts the normal flow of the program. It is an object which is thrown at runtime. SupposeContinue reading “Exception handling”

String Methods

int length(): Returns the number of characters in the String. char charAt(int i): Returns the character at ith index. String substring(int i): Return the substring from the ith  index character to end. String substring(int i,int j): Returns the substring from i to j-1 index. String concat (String str): Concatenates specified string to the end of this string. int indexOf(String s): Returns the indexContinue reading “String Methods”

String is immutable why?

The String is the most widely used data structure. Caching the String literals and reusing them saves a lot of heap space because different String variables refer to the same object in the String pool. String intern pool serves exactly this purpose. When we create a string in java like String s1=”hello”; then an object will be created in string pool(hello) and s1 will be pointing to hello. Now if again we do StringContinue reading “String is immutable why?”

Recursion in java

The process in which a function calls itself directly or indirectly is called recursion and the corresponding function is called as recursive function. Using recursive algorithm, certain problems can be solved quite easily. What is base condition in recursion?In the recursive program, the solution to the base case is provided and the solution of theContinue reading “Recursion in java”

Design a site like this with WordPress.com
Get started