HelloWorld - My First jQuery Program

What is jQuery
jQuery is nothing but JavaScript library that comes with rich functionalities. It's small and faster than many JavaScript code written by an average web developer. By using jQuery we can write less code and do more things, its makes web developer's task very easy. In simple word, jQuery is a collection of several useful methods, which can be used to accomplish many common tasks in JavaScript. A couple of lines of jQuery code can do things which need too many JavaScript lines to accomplish. The true power of jQuery comes from it's CSS-like selector, which allows it to select any element from DOM and modify, update or manipulate it. You can use jQuery to do cool animations like fade in or fade out. You can also change CSS class of a component dynamically e.g. making a component active or inactive. I have used this technique to implement tabbed UI in HTML. I can vouch for jQuery that once you start using it, you will never go back to plain old JavaScript, it's clear, concise and powerful. You will even regret why you are not using jQuery before.

4 Examples to Sort Array in Java

You can use Arrays.sort() method to sort both primitive and object array in Java. This method sorts given array into ascending order, which is the numeric order for primitives and defined by compareTo() or compare() method for objects. For primitive arrays e.g. int,  short, character, float, double or long this method uses  dual-pivot Quicksort sorting algorithm implemented by Vladimir Yaroslavskiy, Jon Bentley, and Joshua Bloch (author of Effective Java) . This algorithm offers O(n log(n)) performance on many data sets that cause other quicksort algorithms to degrade into their worst quadratic performance e.g. O(n^2) and is typically faster than traditional (one-pivot) Quicksort implementations. That's why I always said that prefer library method your own, you can get it right but the amount of exposure library method gets, you will never get for your implementations.

Difference between POST and GET Request in HTTP Protocol

HTTP Protocol supports many method to retrieve data from server or perform any operation on server e.g. upload data, delete file etc. In total, HTTP protocol supports following methods e.g. GET, POST, PUT, DELETE, HEAD, DELETE, OPTIONS and TRACE and HTTP 1.1 reserves method called CONNECT for future use.  GET and POST are two of the most common HTTP methods you would heard or work in web. Though both can be used to send and receive data from client to server, there are some important difference between GET and POST in HTTP, which will help you to understand when you should use GET vs POST while writing your client and server application. HTTP is also programming language independent, doesn't matter whether your client and server is written in Java, or client written in HTML, JavaScript and Server in Java, or client and server both written in .NET, you will use HTTP protocol. In this article, we will learn pros and cons of GET and POST method to choose, which method you should use in HTML forms, considering facts like security, speed and amount of data to transfer.

What is the difference between a Class and an Object in Java?

This article is solely for all beginner programmers, who are learning object oriented programming language e.g. Java, C++ or C# and aspire to do well on any programming interview. The difference between class and object is one of the most common questions, you would like to ask a fresher coming out from college or training institute, but you would be surprised how many beginner Java programmers struggle with this question. Class and Object are two pillars of Object Oriented Programming (OOPS) and a good understanding is a must, but when you ask this question apart from the theoretical and bookish answer that "class is a blueprint and objects are actual things created out of that blueprint", you would hardly get anything substantial. Though that answer is correct and works perfectly, it doesn't differentiate between a programmer, who has just mugged the answer, or the one who truly understand the difference between class and object.

Difference between String literal and New String object in Java

String is a special class in Java API and has so many special behaviours which is not obvious to many programmers. In order to master Java, first step is to master String class, and one way to explore is checking what kind of String related questions are asked on Java interviews. Apart from usual questions like why String is final, or  equals vs == operator, one of the most frequently asked question is what is difference between String literal and String object in Java. For example, what is the difference between String object created in following two expression :
String strObject = new String("Java");
String strLiteral = "Java";
Both expression gives you String object, but there is subtle difference between them. When you create String object using new() operator, it always create a new object in heap memory. On the other hand, if you create object using String literal syntax e.g. "Java", it may return an existing object from String pool (a cache of String object in Perm gen space, which is now moved to heap space in recent Java release), if it's already exists. Otherwise it will create a new string object and put in string pool for future re-use. In rest of this article, why it is one of the most important thing you should remember about String in Java.

What is array data structure in Java? Properties, Example and Tutorial

Without any doubt, an array is one of the most used data structure in all programming language, including Java. Pick up any programming language be it functional, object-oriented, imperative or even scripting languages like Python, Bash, and Perl, you will always find array. That's why it's important for any programmer to have a good understanding of  array data structure. The array is used to store elements in the contiguous memory location and many C, C++ programmer can take advantage of a pointer to work with an array. In Java, there are no pointers and arrays are also a little bit different. They are the object, they have length field which denotes how many elements array can store. Arrays are created in the special memory area called heap memory in JVM, which is also created when you start the JVM. What remains same is that you can access the array element in constant time using their index, this works almost similarly in both C, C++ and Java, they start with 0 and ends at length -1, but Java array has an extra caveat that arrays index access are subject to bound check in Java.