Recent Updates: TIBCO RV FIX PROTOCOL JAVA TUTORIAL

Visit http://javarevisited.blogspot.com/ For Recent Updates.

This Blog Posts All Posts Directory Listings Articles

How to Remove Given Character From String in Java - Recursion

04/11/2015 08:32:00 AM

Write a program to remove a given character from String in Java. Your program must remove all occurrences of given character. For example, if given String is "aaaaa" and String to remove is "a" then output should be an empty String. Similarly if inpu > read more

3 Ways to Prevent Method Overriding in Java - Private, Static and Final

04/08/2015 09:32:00 AM

Every Java programmer knows that final modifier can be used to prevent method overriding in Java because there is now way to override final methods in Java, but apart from final modifier, is there any other way to prevent a Java method to be overridd > read more

Error: Could not find or load main class HelloWorld in Java

04/06/2015 08:38:00 AM

Error: Could not find or load main class HelloWorld comes when you are trying to run your Java program using java command with main class as HelloWorld but Java is not able to find the class. In order to solve this error, you must know how Java find > read more

FizzBuzz Solution in Java 8

04/02/2015 22:49:00 PM

FizzBuzz is one of the most famous programming question from interviews, which is generally used to weed out programmers who can't program. The problem is deceptively simple but you can't solve it if you don't know how to build programmin > read more

Webshpere MQ SSL Errors in Java - Solved

03/31/2015 09:31:00 AM

If you are working in Java application which is using WebSphere MQ for messaging over SSL then you are bound to face some setup, certificate and keystore vs truststore related error. For first timers understanding SSL and MQ errors is nightmare, forg > read more

What is Effectively Final variable of Java 8

03/30/2015 10:05:00 AM

Apart from big three, Lambda expression, Stream API and new Date and Time API, Java 8 has also introduced a new concept called "effectively final" variable. A non final local variable or method parameter whose value is never changed after initializat > read more

Parsing Large JSON Files using Jackson Streaming API Example

03/28/2015 00:14:00 AM

In last couple of JSON tutorials for Java programmers, we have learned how to parse JSON using JSON-Simple library, parsing JSON array to Java array using GSon, and in this tutorial we will learn how to parse a large JSON file in Java using Jackson&# > read more

How to reverse array in place in Java?

03/26/2015 09:35:00 AM

Reversing an array sounds pretty easy, isn't it? It does sounds like that, because all you need to do is create an array of same size, iterate through original array from end to start and populate your new array. Boom!!, you have got an array whi > read more

10 difference between Java and JavaScript for Programmers

03/23/2015 09:29:00 AM

Programmers, developers and internet users  have always been confused between Java and JavaScript.  Many people still thinks that JavaScript is part of Java platform, which is not true. In truth, JavaScript has nothing to do with Java, only common > read more

5 ways to Convert Java 8 Stream to List - Example, Tutorial

03/19/2015 09:47:00 AM

One of the common problem while working with Stream API in Java 8 is how to convert a Stream to List in Java because there is no toList() method present in Stream class. When you are processing a List using Stream's map and filter method, you ide > read more

Top 10 Popular Programming languages and their Creators

03/16/2015 09:05:00 AM

There are many programming languages out there in software world and they are still coming like Scala, Go, Closure etc, but only handful of them has managed to survive till date. These are the ones who has contributed immensely in software developmen > read more

How to find Largest Prime Factor of a Number in Java - Programming Kata

03/13/2015 09:58:00 AM

One of the common programming kata to learn coding is write a program to find the largest prime factor of a number. Like any other programming problem, you need to build the logic to solve this problem. Before solving the problem, let's revise th > read more

How to delete a directory with files in Java - Example

03/12/2015 10:23:00 AM

Deleting an empty directory is easy in Java, just use delete() method of java.io.File class, but deleting a directory with files is unfortunately not easy. You just can't delete a folder if it contains files or sub folders. Calling delete() metho > read more

20 Examples of Date and Time API from Java 8

03/09/2015 08:52:00 AM

Along with lambda expressions, streams and several minor goodies, Java 8 has also introduced brand new Date and Time API, and in this tutorial we will learn how to use Java 8 Date Time API with simple how to do task examples. Java's handling of D > read more

How to Count Number of Words in String - Java Coding Exercise

02/27/2015 07:52:00 AM

String is very popular among Interviewer, and you are bound to see some questions on any programming interview, Java Interviews are no exception. Questions based from Java fundamentals like why String is Immutable in Java to questions based on coding > read more

How to Read File in One Line in JDK 7 or Java 8

02/24/2015 09:34:00 AM

Reading a file in Java is not simple, it requires lots of boiler plate code, as we have seen in our earlier example of reading text files. Various things had to wrapped e.g. a FileInputStream inside a BufferedReader, loops with weird terminating cond > read more

Top 16 jQuery Interview Questions Answers for JavaScript Programmers

02/23/2015 08:14:00 AM

Without a doubt, jQuery has given a much needed boost to JavaScript, a language so useful but equally underrated at times. Before jQuery comes into picture, we used to write lengthy JavaScript code not just for bigger but even for smaller functionali > read more

How to disable JUnit Test - @Ignore annotation Example

02/18/2015 06:36:00 AM

If you are using JUnit 4, then you can use @Ignore annotation to disable a test case; what this means is that, any method which is annotated by @Ignore, will not be executed by JUnit. Why would you want to disable a test? Well, It may be because tha > read more

Difference between UTF-8, UTF-16 and UTF-32 Character Encoding

02/17/2015 07:33:00 AM

Main difference between UTF-8, UTF-16 and UTF-32 character encoding is how many bytes it require to represent a character in memory. UTF-8 uses minimum one byte, while UTF-16 uses minimum 2 bytes. BTW, if character's code point is greater than 12 > read more

How to Find First and Last element of LinkedList Java - Doubly linked list

02/13/2015 22:20:00 PM

In this article you will learn how to get the first and last element of a linked list with the help of getFirst() and getLast() of LinkedList class. If you have programming or even gone to computer science course you probably know what is a linked li > read more

Difference between Right shift and Unsigned right shift in Java ( >> and >>> )

02/12/2015 09:24:00 AM

There are two types of right shift operator in Java >> and >>>,  former is known as right shift and later is known as right shift with zero fill or simply unsigned right shift operator in Java.  Though both of them are known as bit shift operators > read more

Constructor vs Init method in Servlet - JEE Interview Question

02/10/2015 09:00:00 AM

Can we have Constructor in Java Servlet? or Why do we need constructor in Servlet if there is already an init() method for initializing Servlet, or what is difference between init() method and constructor in Servlet are couple of questions I have se > read more

Simple JUnit Example - Unit Tests for Linked List in Java

02/09/2015 07:49:00 AM

From time to time, I have said that a Java programmer must write unit tests. IMHO, unit testing is the best development practice to improve code quality. Fortunately Java eco system has luxury of great unit testing frameworks in form of JUnit and Tes > read more

RandomAccessFile Example in Java : Read Write String

02/06/2015 08:19:00 AM

Random access file is a special kind of file in Java which allows non-sequential or random access to any location in file. This means you don't need to start from 1st line if you want to read line number 10, you can directly go to line 10 and rea > read more

How to Filter Collections in Java 8 with Streams and Predicates

02/04/2015 07:55:00 AM

Java 8 provides excellent features to support filtering of elements in Java Collections. Prior to Java 8, only better way to filter elements is by using foreach loop or iterating over Collection using Iterator and selecting required object, leaving o > read more

Top 50 Programmer Phone Interview Questions with Answers

02/02/2015 08:03:00 AM

It's 2015 now and from last few years phone interviews also known as telephonic round is the single most popular way to screen candidates in a programming job interview. It's easy for both parties to gauge each other, candidate don't need > read more

What is rt.jar in Java/JDK/JRE? Why it’s Important?

01/30/2015 09:40:00 AM

rt.jar stands for runtime JAR and contains the bootstrap classes, I mean all the classes from Core Java API. I have found that many Java programmer doesn't know what is rt.jar? and often confused with the role of rt.jar file or  why we use of rt > read more

How to convert Binary Number to Decimal in Java - Algorithm

01/28/2015 09:02:00 AM

Problem : Write a Java program to convert a binary number into decimal format, without using any library method which can directly solve the problem. You are free to use basic Java functions though e.g. those defined in java.lang and all kinds of Ja > read more

How to use Future and FutureTask in Java Concurrency with Example

01/27/2015 08:56:00 AM

Future and FutureTask in Java allows you to write asynchronous code. Future is a general concurrency abstraction, also known as promise, which promises to return a result in future. In asynchronous programming, main thread doesn't wait for any ta > read more

What is difference between Maven, ANT, Jenkins and Hudson?

01/26/2015 08:30:00 AM

In short, though Maven and ANT are build tool but main difference is that maven also provides dependency management, standard project layout and project management. On difference between Maven, ANT and Jenkins, later is a continuous integration tool > read more

Solaris Command to Show Long argument list of a Running Process

01/23/2015 09:25:00 AM

One of the problem with ps command, which is a popular tool to find any processes along with grep command in Solaris operating system is that it doesn't show full command line argument of process. This means if you are doing grep on any text whi > read more

Difference between Functional and Non-Functional Requirements in Software development

01/21/2015 08:42:00 AM

Gathering the correct and complete requirement is one of the most important thing in software development. Incorrect and incomplete requirement are main reason of why project fails. If you are in software development, you may have come across terms l > read more

Java Clone Tutorial Part 2 - Example to Override with Mutable field

01/20/2015 08:33:00 AM

This is the second part of Java tutorial on Cloning, In first part we have seen how clone method works in Java with a simple example of cloning object, with primitives and Immutable. In this tutorial, we will take one step further and override clone > read more

Print Fibonacci Series in Java Using Recursion and For Loop

01/19/2015 08:27:00 AM

Printing Fibonacci Series In Java or writing a program to generate Fibonacci number is one of the interesting coding problem, used to teach college kids recursion, an important concept where function calls itself. It is also used a lot as coding prob > read more

Top 20 String Coding Interview Questions from Programming Interviews

01/16/2015 09:51:00 AM

In this article we are going to see top 20 String based coding interview question and their solution to help programmers better prepare for interviews. String is one of the most important data structure and available in almost every programming langu > read more

How to use Lambda Expression in Place of Anonymous Class in Java 8

01/15/2015 09:48:00 AM

Before Java 8, Anonymous class was the only way you can implement functional idiom in Java. Since prior to Java 8 you cannot pass function to another function, you would have to wrap it into object, as seen in Strategy Pattern. Those are also known > read more

Top 5 Blogs Java EE developers should follow

01/14/2015 08:43:00 AM

One reason of Java's great success as programming language, is that it has dominated Enterprise space. Earlier J2EE used to be the popular platform, but now we have more modern and improved Java EE platform, with latest release of Java EE 7. Java > read more

Why Override equals, hashcode and toString method in Java

01/12/2015 07:10:00 AM

Couple of questions, which are often asked to me was why do we need to override equals() and hashcode() method, Why should I implement toString(), What will happen if I don't override them or in a different way, I have never overridden equals and > read more

Difference between Bitwsie and Logical Operator in Java - & vs &&, | vs ||

01/08/2015 09:16:00 AM

Java beginners often ask same type of questions, and of them is what is difference between & and && operator in Java or difference between | and || operators? Standard answer of this question is well, main difference between & and && is that former i > read more

Top 5 Java Forums for Programmers

01/06/2015 06:54:00 AM

When you face a Java problem where do you go? StackOverflow, Coderanch or Official Java forums? Yes there are lots of online resources to help a Java programmer when he stuck. Being one of the most popular programming language ever, Java has huge com > read more

3 Examples to Concatenate String in Java

01/05/2015 05:48:00 AM

String concatenation is the process of joining two or more small String to create a big String. For example you can create full name by concatenating first and last name of a person. Java provides multiple ways to concatenate String, but the easiest > read more

Adapter vs Decorator vs Facade vs Proxy Design Pattern in Java

01/01/2015 08:29:00 AM

There is some striking similarity between Adapter, Decorator, Facade and Proxy design pattern, in the sense that they all use Composition and delegation to solve the problem. Adapter pattern wraps an interface, and delegates call to it. Decorator wra > read more

How to print Floyd's Triangle in Java with Example

12/22/2014 08:23:00 AM

There are lots of programming exercise in Java, which involves printing a particular pattern in console, one of them is printing Floyd triangle in console. In Floyd triangle there are n integers in the nth row and a total of (n(n+1))/2 integers in n > read more

Insertion Sort Algorithm in Java to Sort Array

12/16/2014 07:59:00 AM

Insertion sort is another simple sorting algorithm, which can be used to sort any linear data structure like array and linked list. On simplicity this is next to bubble sort, and it’s also pretty close to how humans manually sort something (for exa > read more

9 Things about Null in Java

12/10/2014 09:42:00 AM

Java and null are uniquely bonded. There is hardly a Java programmer, who is not troubled by null pointer exception, it is the most infamous fact about. Even inventor of null concept has called it his billion dollar mistake, then why Java kept it? Nu > read more

How to do static import in Eclipse - Java

12/05/2014 09:07:00 AM

Do you know what is shortcut of doing static import in Eclipse? Well I didn't know before, but today I come to know that shortcut Ctrl+Shift+M (Source > Add Import) can not only be used to add missing imports but It can also help with static impo > read more

Where does Java used in Real World?

12/03/2014 08:23:00 AM

If you are a beginner and just started learning Java, you might be thinking where exactly Java is used? You don't see many games written in Java except Minecraft, desktop tools like Adobe Acrobat, Microsoft Office are not written in Java, neither > read more

How to Read Write JSON String to File in Java with Example

12/01/2014 08:51:00 AM

JSON is a text format is a widely used as data-interchange language because its parsing and its generation is easy for programs. It is slowly replacing XML as most powerful data interchange format, as it is lightweight, consumes less bandwidth and al > read more

How to Find Missing Number on Integer Array of 1 to 100 - BitSet Example

11/28/2014 09:15:00 AM

One of the most frequently asked question on programming interviews is, write a program to find missing number in an array in Java, C# or any other language; depending upon which language you choose. This kind of coding interview questions are not on > read more

Does column width 80 make sense in 2014?

11/26/2014 08:33:00 AM

One of the oldest coding practice is to keep line width 80, Why? I believe it was to make your code more readable in the age of small monitors so that whole content can fit in screen, or it might have origin from the age of punch card, which was used > read more

Don't use System.exit() on Java Web Application

11/24/2014 08:36:00 AM

I have recently come across a code snippet, where programmer was using System.exit() if application failed to acquire necessary resource after couple of retry. His reasoning was that since, application cannot function, if essential resources like dat > read more

How to loop a HashMap or Hashtable in JSP

11/21/2014 08:40:00 AM

Though there are number of ways to loop over HashMap in JSP, or any other Map implementation e.g. Hashtable, I personally prefer JSTL foreach tag for this. As a Java programmer, I often have urge to use Java code directly in JSP using scriptlet, but > read more

Strategy Design Pattern in Java using Enum - Tutorial Example

11/19/2014 07:41:00 AM

I have said this before that Java Enum is very versatile and can do lot more than you normally expect from it. We have seen lot of examples of Enum in my earlier posts e.g. writing thread-safe Singleton using Enum and 10 ways to use Enum in Java. In > read more

Why Use Interface in Java or Object Oriented Programming

11/17/2014 07:02:00 AM

Many times, I have seen questions like why should we use interface in Java, if we can not define any concrete methods inside interface? Or even more common, What is the real use of interface in Java? I can understand beginners asking this question, w > read more

java.io.IOException: Map failed and java.lang.OutOfMemoryError: Map failed

11/16/2014 05:00:00 AM

While working with memory mapped file, you may get java.io.IOException: Map failed error, which is mainly caused by Caused by: java.lang.OutOfMemoryError: Map failed error as shown below. This error usually comes while mapping a big file in memory e. > read more

How to Make and Run batch .bat file in Windows 8

11/14/2014 07:33:00 AM

batch files and shell scripts are developers best friend, they help to improve productivity a lot. They not only help you to automate boring, time consuming task but also saves lot of time doing and doing them again. Batch file also reduce chances of > read more

Difference between jQuery Document Ready Method and JavaScript Window Onload Event

11/13/2014 08:13:00 AM

Though both jQuery ready event and window onload event is used to perform task when page is loaded, there is subtle difference between them. jQuery document.ready method, which is not method but a jQuery event is fired, when DOM is ready i.e. all ele > read more

How to Use Locks in Multi-threaded Java Program

10/14/2014 09:09:00 AM

Many Java programmers confused themselves like hell while writing multi-threaded Java programs e.g. where to synchronized? Which Lock to use? What Lock to use etc. I often receive request to explain about how to use Locks in Java, so I thought to wri > read more

Right way to Close InputStream and OutputStream in Java

10/09/2014 09:02:00 AM

For some unknown reasons many Java programmers are not very comfortable with IO package. I don't know why, but I have found them much more comfortable with java.lang and java.util than java.io. One possible reason of this could be that, writing > read more

10 Programming Best Practices to Name Variables, Methods, Classes and Packages

10/07/2014 08:57:00 AM

What's in name? "A rose by any other name would smell as sweet" is a famous quote from William Shakespeare's classic Romeo and Juliet, but sorry to say, name matter a lot in programming and coding.  It's also said that code is the best d > read more

5 Articles to Learn about Shellshock Bash Bug

10/02/2014 07:01:00 AM

The year of 2014 is looking like an year of biggest software bug and vulnerabilities. Earlier this year, internet was bleeding by Heartbleed vulnerability and now it's shocked by ShellShock bug. To me it looks like even bigger than Heartbleed, ju > read more

ORA-00904: invalid identifier Error in Oracle 11g database - Solved

09/30/2014 09:42:00 AM

If you have worked in Oracle database ever, you would definitely have seen ORA-00904: invalid identifier error. Doesn't matter which version you are working 10g, 11g or 12g, this is one of the most common error comes while doing CRUD (Create, Rea > read more

Java 8 Certification - Oracle Java SE 8 Programmer 1 (1Z1-808) - Latest OCPJP Exam

09/25/2014 08:56:00 AM

Today one of my reader asked about what is the latest OCPJP or SCJP exams available,  which prompted me to browse through Oracle's certification website. During my casual browsing, I noticed this new Java 8 certification. I said great, within si > read more

Common Multi-threading Mistakes in Java - Calling run() instead of start()

09/22/2014 09:41:00 AM

Writing multi-threaded and concurrent programs is not easy, not even in Java.  Even senior developers, including myself, make mistakes while writing concurrent Java applications. This is also one of the trickiest area of Java programming language, w > read more

How to Create Complex directory Tree Using mkdir -p Command in UNIX

09/19/2014 09:40:00 AM

One of the most common task in any Linux is creating directories, and most of us spend a lot of time creating complex directory structure in UNIX.  I am sure you know about mkdir command, we have been using this command in almost every operating sys > read more

10 Questions To Make Programming Interviews Less Expensive

09/17/2014 09:22:00 AM

Conducting Interview is not cheap and costs both time and money to a company. It take a lot of time to find the right candidate for a job from 100s resume you receive from consultants and agents. They will always tell you that this guy is a Java Guru > read more

6 Books to Learn and Master Programming and Coding - Must Read

09/15/2014 08:53:00 AM

Coding is an integral part of programming and we all somehow learn coding by following examples here and there. What is more difficult is to write good code. You can easily find programmers in Java, C++, Ruby or Python, but finding programmers, who a > read more

3 Examples of Parsing HTML File in Java using Jsoup

09/11/2014 09:16:00 AM

HTML is core of web, all the page you see in internet are HTML, whether they are dynamically generated by JavaScript, JSP, PHP, ASP or any other web technology. Your browser actually parse HTML and render it for you. But what would you do,  if you n > read more

Maven Dependency Search Not Working in Eclipse - Solved

09/09/2014 07:51:00 AM

Recently I face an strange issue while using Maven in Eclipse via M2Eclipse plugin. I have created a Maven Java project in Eclipse and subsequently tried to add Spring framework as dependency, to my surprise, nothing was happening. Eclipse was not ab > read more

Why you should control Visibility of Class and Interface in Java

09/02/2014 08:57:00 AM

One of the important aspect of software development is maintenance, and  it's proven by experience that a software which keeps visibility of its component low is more maintainable than the one who exposes its component more. You won't realiz > read more

Quicksort Sorting Algorithm in Java

08/28/2014 07:13:00 AM

Quicksort algorithm is one of the most used sorting algorithm, especially to sort large list and most of the programming languages, library have implemented it in one or another way. In Java, Arrays.sort() method sorts primitive data types using doub > read more

2 Examples to Convert Byte[] array to String in Java

08/26/2014 10:49:00 AM

Converting a byte array to String seems easy but what is difficult is, doing it correctly. Many programmers make mistake of ignoring character encoding whenever bytes are converted into a String or char or vice versa. As a programmer, we all know tha > read more

15 Java Socket Programming, Networking Interview Questions and Answers

08/19/2014 07:49:00 AM

Networking and Socket Programming is one of the important area of Java programming language, especially for those programmers, who are working in client server based applications. Knowledge of important protocols e.g. TCP and UDP in detail is very im > read more

Bubble Sort Algorithm in Java with Example

08/14/2014 10:38:00 AM

Bubble Sort is the first sorting algorithm I learned during my college day, and after so many years it's the one I remember by heart. It's kind of weird that one of the most popular sorting algorithm is also one of the worst performing sortin > read more

How to find all Pairs in Array of Integers whose Sum is equal to a given Number

08/12/2014 08:22:00 AM

Practising coding problems are very important to do well in any programming interview. You should at your best on data-structures like array, linked list, and string to clear any programming interview, and believe me you can not do this in one day or > read more

Difference between getPath(), getCanonicalPath() and getAbsolutePath() of File in Java

08/08/2014 09:17:00 AM

File API is very important one in Java, it gives access of File system to Java programs. Though Java's file API is rich, there are lot of subtleties to know when you use them. One of the common query programmer's has about file path is differ > read more

5 Good Books to Learn Unit testing, JUnit and TDD for Java Developers

08/06/2014 08:18:00 AM

Unit testing is very, very important thing to learn adapt. I would say this is the single most practice in my book which differentiate a good programmer with a professional programmer. It's one way you can see how disciplined a programmer is? It& > read more

How to Send Email from Java Program with Example

08/04/2014 08:44:00 AM

Sending Email from Java program is a common requirement. It doesn't matter whether you are working on core Java application, web application or enterprise Java EE application, you may need to send email to alert support personal with errors, or j > read more

How to See difference between two Files in Eclipse - Text Comparision

08/01/2014 10:59:00 AM

One of the common task for every programmer is is to compare two files and find out difference between them. You would do this while comparing same file from different release version or from different environment to find out exactly what has changed > read more

How to Load Resources from Classpath in Java with Example

07/30/2014 09:15:00 AM

Classpath in Java is not only used to load .class files, but also can be used to load resources e.g. properties file, images, icons, thumbnails, or any binary content. Java provides API to read these resources as InputStream or URL. Suppose, you have > read more

Default, Defender or Extension Method of Java 8 with Example

07/28/2014 09:49:00 AM

Java 8 now allows you to add non-abstract method implementations to interfaces by utilizing the default and static keyword. Methods with default keyword are known as default methods or defender methods in Java. Before Java 8, it was virtually impossi > read more

Java ArrayList and HashMap Performance Improvement in JDK 1.7| Empty List and Map will Cost Less Memory

07/23/2014 09:18:00 AM

From long time one reason for me to update to newer Java version was always bug fix and performance improvement. Apart from major changes like Generics in Java 1.5 and Lambdas in Java 8, there are so many small improvements, performance optimization > read more

9 Difference between TCP and UDP Protocol - Java Network Interview Question

07/17/2014 09:44:00 AM

TCP and UDP are two transport layer protocols, which are extensively used in internet for transmitting data between one host to another. Good knowledge of how TCP and UDP works is essential for any programmer. That's why difference between TCP an > read more

How to Find Largest of Three Integers in Java - Algorithm, Logic Example

07/14/2014 09:58:00 AM

One of the classical program to build programming logic is, write a program to find largest of three numbers. I am sure many of you have already done this exercise in variety of languages including C, C++, C#, JavaScript, Perl, Ruby, PHP etc. This ti > read more

Write a Program to Find all Armstrong number in the range of 0 and 9999 - Example

07/10/2014 09:19:00 AM

An Armstrong number of three digits is an integer such that the sum of the cubes of its digits is equal to the number itself. For example, 153 is an Armstrong number, since 1**3 + 5**3 + 3**3 = 153, 371 is an Armstrong number since 3**3 + 7**3 + 1**3 > read more

Top 5 Java Performance Tuning Books - Best of Lot, Must read

07/08/2014 07:59:00 AM

Why Java developer should read a book on Performance tuning? When I first faced this question long time back, I thought I will do it later, but I never get back to that for a long time. I realize my mistake of having lack of knowledge on performance > read more

Top 50 Java Thread Interview Questions Answers for Freshers, Experienced Programmers

07/02/2014 08:28:00 AM

You go to any Java interview, senior or junior, experience or freshers,  you are bound to see couple of questions from thread, concurrency and multi-threading. In fact this built-in concurrency support is one of the strongest point of Java programmi > read more

How to create Custom Exception in Java - Tutorial Example

06/30/2014 08:54:00 AM

Sometime we need to create custom Exception in Java, i.e. Exceptions which are not defined in JDK or any third party library your application is using. Though it’s widely recommended on several Exception best practices article, even Joshua Bloch ha > read more

How to use CopyOnWriteArraySet in Java with Example

06/26/2014 08:09:00 AM

CopyOnWriteArraySet is little brother of CopyOnWriteArrayList class. These are special purpose collection classes which was added on JDK 1.5, along with their most popular cousin ConcurrentHashMap. They are part of concurrent collection framework and > read more

20 Fancy Acronyms Programmers should know?

06/23/2014 08:26:00 AM

Do you read blogs on Internet? Do you understand what TL;DR or ITT means, Well I didn't, not until last year. Internet is full of acronyms. Techies, programmers, developers and bloggers has developed a lot more fancy acronyms than you can think o > read more

How to Count number of Set bits or 1's in Integer on Java?

06/17/2014 09:55:00 AM

There are multiple ways to count number of 1's or set bits in a integer number in Java. You can use bitwise and bit shift operator by your own, or, you can use Java API to count number of set bits. Java 1.5 added two utility method called bitCoun > read more

Is Java Compiled or Interpreted Programming language?

06/11/2014 09:49:00 AM

One of the first question a graduate C or C++ programmer, who has just started learning Java ask is, whether Java is a compiled language or an interpreted one? On academic courses or during college, students learn a lot of languages e.g. VB, C, C++ a > read more

SynchronousQueue Example in Java - Produer Consumer Solution

06/09/2014 09:44:00 AM

SynchronousQueue is special kind of BlockingQueue in which each insert operation must wait for a corresponding remove operation by another thread, and vice versa. When you call put() method on SynchronousQueue it blocks until another thread is there > read more

Exception in thread "main" java.lang.ExceptionInInitializerError in Java Program

06/06/2014 09:23:00 AM

JVM throws java.lang.ExceptionInInitializerError, when there is an Exception inside static initializer block. If you know about static variable in Java, then you may know that they are initialized at the time of class loading. If there is an Exceptio > read more

2 Examples to read Zip Files in Java, ZipFile vs ZipInputStream

06/03/2014 08:27:00 AM

ZIP format is one of the most popular compression mechanism in computer world. A Zip file may contains multiples files or folder in compressed format.  Java API provides extensive support to read Zip files, all classes related to zip file processing > read more

jQuery Class and ID Selector Example Tutorial

05/31/2014 08:02:00 AM

One of the best thing of jQuery is there selectors, which gives jQuery enormous power to find and select DOM elements so easily. If you are coming from JavaScript background then you might love those classical methods e.g. getElementById() and getEle > read more

Law of Demeter in Java - Principle of least Knowledge - Real life Example

05/28/2014 08:50:00 AM

Law of Demeter also known as principle of least knowledge is a coding principle, which says that a module should not know about the inner details of the objects it manipulates. If a code depends upon internal details of a particular object, there is > read more

Double Checked Locking on Singleton Class in Java

05/26/2014 09:47:00 AM

Singleton class is quite common among Java developers, but it poses many challenges to junior developers. One of the key challenge they face is how to keep Singleton class as Singleton? i.e. how to prevent multiple instances of a Singleton due to wha > read more

Why use SerialVersionUID inside Serializable class in Java

05/22/2014 10:42:00 AM

Serialization and SerialVersionUID is always remains a puzzle for many Java developers. I often see questions like what is this SerialVersionUID, or what will happen if I don't declare SerialVersionUID in my Serializable class? Apart from complex > read more

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 5 - Solving Array IndexOutOfBoundsException in Java

05/19/2014 09:40:00 AM

If you are coming from C background than there is pleasant surprise for you, Java programming language provides implicit bound checks on Array, which means an invalid array index access is not allowed in Java and it will result in java.lang.ArrayInde > read more



© 2006-2015 OnToplist.com, All Rights Reserved