Blog Feed: TIBCO RV FIX PROTOCOL JAVA TUTORIAL

Blog Feed: TIBCO RV FIX PROTOCOL JAVA TUTORIAL

Already a Member? Log In to Your Account


SED Command Examples in UNIX and Linux, Find and Replace using Regular Expression

Published on 2013-05-20 07:52:00

SED command in UNIX  is stands for stream editor and it can perform lot's of function on file like, searching, find and replace, insertion or deletion. Though most common use of SED command in UNIX is for substitution or for find and replace. By

How to Generate Random Numbers in Java between Range - Example Tutorial

Published on 2013-05-17 08:53:00

In software development and programming world we often needs to generate random numbers, some time random integers in a range e.g. 1 to 100 etc. Thankfully, Random number generation in Java is easy as Java API provides good support for random numbers

Difference between Abstract class vs Interface in Java and When to use them

Published on 2013-05-14 07:46:00

When to use interface and abstract class is one of the most popular object oriented design questions and almost always asked in Java, C# and C++ interviews. In this article, we will mostly talk in context of Java programming language, but it equally

How to Find if Linked List contains Loops or Cycles in Java - Coding Question

Published on 2013-05-13 08:37:00

Write a Java program to check if a linked list is circular or cyclic,  and how do you find if a linked list contains loop or cycles in Java are some common linked list related data structure interview questions asked in various Java Interviews. This

Difference between LEFT and RIGHT OUTER Joins in SQL - MySQL Join example

Published on 2013-05-10 08:14:00

There are two kinds of OUTER joins in SQL, LEFT OUTER join and RIGHT OUTER join. Main difference between RIGHT OUTER join and LEFT OUTER join, as there name suggest, is inclusion of non matched rows. Sine INNER join only include matching rows, where

Migrating SQL Query from Oracle to SQL Server 2008 or Sybase

Published on 2013-05-09 08:35:00

Oracle and Microsoft SQL Server are very different than each other and if you are migrating SQL queries or database, tables from Oracle 11g database to Microsoft 2008 SQL server than you are bound to face some issues. Main reason of these porting iss

How to convert List of Integers to int array in Java - Coding Tips

Published on 2013-05-08 08:29:00

So, you have a List of Integers and you want to convert them into int array? Yes you read it write, not on Integer array but int array. Though in most practical purpose, Integer array can be used in place of int[] because of autoboxing in Java, you s

10 Hibernate Interview Questions and Answers for Java J2EE Programmers

Published on 2013-05-07 07:43:00

Hibernate Interview Questions are asked on Java J2EE Interviews, mostly for web based enterprise application development role. Success and acceptability of Hibernate framework on Java world has made it one of the most popular Object Relational Mappin

Java Mistake 3 - Using "==" instead of equals() to compare Objects in Java

Published on 2013-05-06 07:56:00

In this part of Java programming mistakes, we will take a look on another common pattern, where programmers tend to use "==" operator to compare Objects, similar to comparing primitives. Since equality of object can be very different in physical and

Java Program to Find Sum of Digits in a Number using Recursion - Interview Question

Published on 2013-05-02 07:09:00

Recently this question to asked was one of my reader, which inspired me to write this tutorial. There was usual check to solve this problem using both recursion and iteration. To be frank, calculating sum of digit of an integral number, is not diffic

How to Find Runtime of a Process in UNIX and Linux

Published on 2013-04-30 08:33:00

So you checked your process is running in Linux operating system and it's running find, by using ps command. But now you want to know, from how long process is running, What is start date of that process etc. Unfortunately ps command in Linux or

Eclipse No Java Virtual Machine was found Windows JRE JDK 64 32 bit Error

Published on 2013-04-29 08:25:00

One of my reader was installing Eclipse in his Windows 7 x86 machine and emailed me about this error "A java Runtime Environment (JRE) or Java Development kit (JDK) must be available in order to run Eclipse. No Java virtual machine was found". Before

What is java.library.path , How to set in Eclipse IDE

Published on 2013-04-26 09:27:00

java.library.path is a System property, which is used by Java programming language, mostly JVM, to search native libraries, required by project. Similar to PATH and Classpath environment variable, java.library.path also includes a list of directory.

Difference between valueOf and parseInt method in Java

Published on 2013-04-25 08:30:00

Both valueOf and parseInt methods are used to convert String to Integer in Java, but there are subtle difference between them. If you look at code of valueOf() method, you will find that internally it calls parseInt() method to convert Integer to Str

10 Reasons to Learn Java Programming Language and Why Java is Best

Published on 2013-04-23 08:54:00

Java is one of the best programming language created ever, and I am not saying this, because I am a passionate Java developer, but Java has proved it in last 20 years. Two decades is a big time for any Programming language, and Java has gained streng

What is String args[] in Java main method

Published on 2013-04-22 07:41:00

What is String args is used for or Why we use String arg[] in main method is a common doubt among Java beginners. First thing newbies exposed while learning Java programming language is writing HelloWorld program in Java, Though HelloWorld is smalles

How to Convert InputStream to Byte Array in Java - 2 Examples

Published on 2013-04-19 07:14:00

Sometimes we need to convert InputStream to byte array in Java, or you can say reading InputStream as byte array, In order to pass output to a method which accept byte array rather than InputStream. One popular example of this, I have seen is older v

10 Abstract Class and Interface Interview Questions Answers in Java

Published on 2013-04-16 08:01:00

Abstract class and interface is very popular in any object oriented programming language or Java interview, and there are always one or more questions from this. Interface is more common, because of its popularity among designers but questions from a

How to Convert JSON array to String array in Java - GSon example

Published on 2013-04-15 09:28:00

JSON array is a ordered collection of values, which are enclosed within brackets e.g. [] and separated by comma. In this Java tutorial we will convert JSON Array to String array in Java and subsequently create JSON from Java String Array. This tutori

Top 10 Puzzles, Riddles, Logical and Lateral Thinking questions asked in Programming Job Interviews

Published on 2013-04-12 08:33:00

Puzzles, riddles, logical questions, and lateral thinking questions are integral part of any programming job interviews. I missed to include some puzzles, when I shared my list of top 30 programming interview questions earlier, and couple of my frien

How to Check If Number is Even or Odd without using Modulus or Remainder Operator

Published on 2013-04-11 07:27:00

Write a Java program to find if a number is odd or even is one of the basic programming exercise, and anyone will be happy to see this in actual Java Interviews, wouldn't you? By the way did I said easy, well there is a little twist there, you ne

How to Compare Two Enum in Java - Equals vs == vs CompareTo

Published on 2013-04-09 07:48:00

How do I compare two enum in Java? Should I use == operator or equals() method? What is difference between comparing enum with == and equals() method are some of the tricky Java questions. Until you have solid knowledge of Enum in Java, It can be dif

How to get current stack trace in Java for a Thread - Debugging Tutorial

Published on 2013-04-08 08:19:00

Stack trace is very useful while debugging or troubleshooting any issue in Java. Thankfully Java provides couple of ways to get current stack trace of a Thread in Java, which can be really handy in debugging. When I was new to Java programming, and d

Spring Framework Tutorial - How to call Stored Procedures from Java using IN and OUT parameter example

Published on 2013-04-05 07:27:00

Spring Framework provides excellent support to call stored procedures from Java application. In fact there are multiple ways to call stored procedure in Spring Framework, e.g. you can use one of the query() method from JdbcTemplate to call stored pro

How to increment decrement date by days in Java - Tutorial example

Published on 2013-04-04 09:23:00

While working in Java projects, we often needs to increment or decrement date e.g. adding one days to current date to get tomorrow's date, subtracting one day to get yesterday's date etc. Since date in Java is maintained as long millisecond v

Difference between trunk, tags and branches in SVN or Subversion source control system

Published on 2013-04-03 07:28:00

SVN or Subversion is one of the popular source control system used in Java world for source code management. There are lot of source control system available e.g. Git, Perforce, CVS, Clearcase, VSS, but SVN has it’s own place among Java developer a

What is maximum Java Heap Size for 32 bit and 64-bit JVM - Frequently asked Questions

Published on 2013-04-02 10:08:00

Maximum heap size  for 32 bit or 64 bit JVM looks easy to determine by looking at addressable memory space like 2^32 (4GB) for 32 bit JVM and 2^64 for 64 bit JVM. Confusion starts here because you can not really set 4GB as maximum heap size for 32 b

JUnit 4 Tutorial - Test Exception thrown by Java Method with Example

Published on 2013-04-01 07:38:00

One part of unit testing a Java method is checking exception thrown by that method. A Java unit test should verify correct exception thrown in exceptional case and no exception should be thrown in normal case. In JUnit 3.XX, there was no direct suppo

How to Convert and Print Byte array to Hex String in Java

Published on 2013-03-28 08:09:00

We often needs to convert byte arrays to Hex String in Java, In order to print byte array contents in readable format. Since many cryptographic algorithm e.g. MD5 return hash value as byte array, In order to see and compare those byte array, you need

10 Exception handling Best Practices in Java Programming

Published on 2013-03-25 08:30:00

Exception handling is an important part of writing robust Java application. It’s a non functional requirement for any application, to gracefully handle any erroneous condition like resource not available, invalid input, null input and so on. Java p

How to Reverse Array in Java - Int and String Array Example

Published on 2013-03-22 08:26:00

This Java tips is about, how to reverse array in Java, mostly primitive types e.g. int, long, double and String arrays. Despite of Java’s rich Collection API, use of array is quite common, but standard JDK doesn’t has great utility classes for Ja

How to check if two String are Anagram in Java - Program Example

Published on 2013-03-21 07:47:00

Write a Java program to check if two String are anagram of each other, is another good coding question asked at fresher level Java Interviews. This question is on similar level of finding middle element of LinkedList in one pass and swapping two numb

How to generate MD5 Hash in Java - String Byte Array digest Example

Published on 2013-03-20 08:11:00

There are multiple ways to generate MD5 hash in Java program. Not only Java API provides convenient method to generate MD5 hash, you can also use popular open source frameworks, like Spring and Apache commons Codec to generate MD5 digest in Java. MD5

10 Famous Laws of Computer Programming and Software Enginnering World

Published on 2013-03-19 08:03:00

Like any other field, Software and Programming world too has some interesting and famous rules, principles and laws, which programmers, developers, managers and architects use often in conversations, meetings and chats. These laws are either rules, p

Can we Overload and Override Static methods in Java - Interview Question

Published on 2013-03-18 08:09:00

Can static method be overridden in Java, or can you override and overload static method in Java, is a common Java interview question, mostly asked to 2 years experienced Java programmers. Answer is, No, you can not override static method in Java, tho

Top 15 Data Structures and Algorithm Interview Questions for Java programmer - Answers

Published on 2013-03-15 09:09:00

Data structures and algorithm questions are important part of any programming job interview, be it a Java interview, C++ interview or any other programming language. Since data structures is core programming concept, its mandatory for all programmers

Difference between Struts 1 and Struts 2 framework

Published on 2013-03-13 07:46:00

I had work previously on Struts 1 but never touched Struts 2, specially since Spring MVC was there to take the leading role. Recently one of my friend ask me to help with Struts2, which leads me to look on Struts2 framework from start. First thing I

Bitwise and BitShift Operators in Java - AND, OR, XOR, Signed Left and Right shift Operator Examples

Published on 2013-03-12 09:03:00

Bitwise and Bit Shift operators in Java are powerful set of operators which allows you to manipulate bits on integral types like int, long, short, bytes and boolean data types in Java. Bitwise and Bit shift operator are among the fastest operator in

Difference between Singleton Pattern vs Static Class in Java

Published on 2013-03-11 07:46:00

Singleton pattern  vs  Static Class (a class, having all static methods) is another interesting questions, which I missed while blogging about Interview questions on Singleton pattern in Java. Since both Singleton pattern and static class provides

How to Increase Console Buffer Size in Eclipse IDE - Output and Debug Console

Published on 2013-03-08 22:23:00

By default Eclipse IDE has limit on console output, also known as console buffer size. Which means, your Eclipse console will overfill quickly, if you are running a Java server program, which usually do lot of logging. Once this happen, you start los

ReentrantLock Example in Java, Difference between synchronized vs ReentrantLock

Published on 2013-03-07 06:22:00

ReentrantLock in Java is added on java.util.concurrent package in Java 1.5 along with other concurrent utilities like CountDownLatch, Executors and CyclicBarrier. ReentrantLock is one of the most useful addition in Java concurrency package and severa

5 books to learn Spring framework and Spring MVC for Java Programmers

Published on 2013-03-05 07:24:00

Spring and Spring MVC is one of the most popular Java framework and most of new Java projects uses Spring these days. Java programmer often ask questions like which books is good to learn Spring MVC or What is the best book to learn Spring framework

How to create Immutable Class and Object in Java - Tutorial Example

Published on 2013-03-04 06:28:00

Writing or creating immutable classes in Java is becoming popular day by day, because of concurrency and multithreading advantage provided by immutable objects. Immutable objects offers several benefits over conventional mutable object, especially wh

How to write Unit Test in Java using JUnit4 in Eclipse and Netbeans

Published on 2013-03-01 08:45:00

Writing Junit tests for Java classes in Eclipse and Netbeans IDE are super easy, and I will show you with that later in this JUnit tutorial. Before that, let’s revise what is unit test and why should you write them. Unit test is to test smaller uni

How to use ConcurrentHashMap in Java - Example Tutorial and Working

Published on 2013-02-27 08:54:00

ConcurrentHashMap in Java is introduced as an alternative of Hashtable in Java 1.5 as part of Java concurrency package. Prior to Java 1.5 if you need a Map implementation, which can be safely used in a concurrent and multi-threaded Java program, than

How to get Key from Value in Hashtable or Map in Java

Published on 2013-02-26 07:23:00

It's not easy to get key from value in Hashtable or HashMap, as compared to getting value from key, because Hash Map or Hashtable doesn't enforce one to one mapping between key and value inside Map in Java. infact Map allows same value to be

2 ways to combine Arrays in Java – Integer, String Array Copy Example

Published on 2013-02-23 07:30:00

In this Java example we will combine two int arrays and than, two String arrays. We will use Apache commons ArrayUtils.addAll() method to combine two integer arrays in Java and Google's Guava library to join two String array in Java. Though we ca

How to Swap Two Numbers without Temp or Third variable in Java - Interview Question

Published on 2013-02-21 07:33:00

How to swap two numbers without using temp or third variable is common interview question not just on Java interviews but also on C and C++ interviews. It is also a good programming questions for freshers. This question was asked to me long back and

How to install JDK 7 on Windows 8 - Java Programming Tutorial

Published on 2013-02-19 07:49:00

Installing JDK is first step in learning Java Programming. If you are using Windows 8 or Windows 7 Operating System, than installing JDK is quite easy as you just need to follow instruction given by Java SE Installation wizard. Only thing which requi

How to create and call stored procedure in MySQL with IN and OUT parameters

Published on 2013-02-17 06:45:00

It's hard to remember exact syntax of, how to create stored procedure in MySQL, until you are creating and working on stored procedure frequently, simply because syntax is not a one liner. You need to remember exact syntax, if you are using MySQL

How to set Java Path and Classpath in Windows 8 and Windows 7 - Tutorial

Published on 2013-02-16 08:30:00

So, you just bought a new PC or Laptop with Windows 8 operating system, and wondering how to set PATH and Classpath on Windows 8; Or, you might have just upgraded your windows 7 laptop to professional edition of Windows 8 and looking to set JDK Path

How to convert XMLGregorianCalendar to Date to XMLGregorianCalendar in Java - Example Tutorial

Published on 2013-02-15 08:48:00

There are several ways to convert XMLGregorianCalendar to Date in Java. You can convert XMLGregorianCalendar to either java.util.Date or java.sql.Date based upon your need. JAXB (Java API/Architecture for XML Bindings) is a popular framework to creat

How to add leading zeros to Integers in Java – String left padding Example Program

Published on 2013-02-14 07:51:00

From Java 5 onwards it's easy to left pad Integers with leading zeros when printing number as String. In fact, You can use same technique to left and right pad Java String with any characters including zeros, space. Java 5 provides String format

5 JSTL Core IF Tag Examples in JSP - Tutorial

Published on 2013-02-12 07:27:00

 or if tag of JSTL core tag library in JSP is one of the most versatile and useful tag. JSTL if tag allows you to test for a condition, like checking for a particular parameter in requestScope, sessionScope or pageScope. You can also  check any pa

How to convert JSON String to Java object - Jackson Example

Published on 2013-02-11 06:19:00

JSON, stands for JavaScript object notation, is a light weight text or string representation of object and quickly becoming a popular data exchange format. Though it's pretty early to say that JSON is going to replace XML as popular data intercha

How to Fix java.net.ConnectException: Connection refused: connect in Java

Published on 2013-02-08 07:26:00

java.net.ConnectException: Connection refused: connect is one of the most common networking exception in Java. This error comes when you are working with client-server architecture and trying to make TCP connection from client to server. Though this

Top 5 Concurrent Collections from JDK 5 and 6 Java Programmer Should Know

Published on 2013-02-07 07:32:00

Several new Collection classes are added in Java 5 and Java 6 specially concurrent alternatives of standard synchronized ArrayList, Hashtable and  synchronized HashMap collection classes. Many Java programmer still not familiar with these new collec

How to Join Multiple Threads in Java - Thread Join Example

Published on 2013-02-06 07:27:00

Join method from Thread class is an important method and used to impose order on execution of multiple Threads. Concept of joining multiple threads is very popular on  mutithreading interview question. Here is one of such question, “You have three

How to disable submit button in HTML JavaScript to prevent multiple form submission

Published on 2013-02-04 23:51:00

Avoiding multiple submission of HTML form or POST data is common requirement in Java web application. Thankfully, You can prevent multiple submission by disabling submit button in HTML and JavaScript itself, rather than handling it on server side. Th

What is Timer and TimerTask in Java – Tutorial Example

Published on 2013-02-04 00:10:00

Timer in Java is a utility class which is used to schedule tasks for both one time and repeated execution. Timer is similar to alarm facility many people use in mobile phone. Just like you can have one time alarm or repeated alarm, You can use java.u

How to Fix Must Override a Superclass Method Error Eclipse IDE Java

Published on 2013-02-03 01:19:00

One of annoying error while overriding Java method in Eclipse IDE is must override a superclass method error , This error is quite frequent when importing Java  projects and still I haven't seen any permanent solution of it. Must override a supe

5 ways to check if String is empty in Java - examples

Published on 2013-02-01 06:51:00

String in Java is considered empty if its not null and it’s length is zero. By the way before checking length you should verify that String is not null because calling length() method on null String will result in java.lang.NullPointerException. Em

Difference between IdentityHashMap and HashMap in Java

Published on 2013-01-28 08:55:00

IdentityHashMap in Java was added in Java 1.4 but still its one of those lessor known class in Java. Main difference between IdentityHashMap and HashMap in Java is that IdentityHashMap is a special implementation of Map interface which doesn't us

Spring - java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener Quick Solution

Published on 2013-01-26 23:18:00

If you have worked in Spring MVC than you may be familiar with   java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener,  which is common problem during deployment. Spring MVC throws  java.lang.ClassNotFoundExcepti

JAXB XML Binding tutorial - Marshalling UnMarshalling Java Object to XML

Published on 2013-01-24 07:12:00

XML binding is a concept of generating Java objects from XML and opposite  i.e. XML documents from Java object. Along with parsing XML documents using DOM and SAX parser, XML binding is a key concept to learn if you are working in a Java application

Difference between Stack and Heap memory in Java

Published on 2013-01-22 08:01:00

Difference between stack and heap memory is common programming question asked by beginners learning Java or any other programming language. Stack and heap memory are two terms programmers starts hearing once they started programming but without any c

Display Tag Export Example in JSP – Issue Fix Java Tutorial

Published on 2013-01-21 07:31:00

Display tag provides export options to export page into PDF, CSV, Excel and XML in Java web application written using JSP, Servlet, Struts or Spring MVC framework. Display tag is a tag library and you just need to use it in your JSP page to display t

How to fix Failed to load Main-Class manifest attribute from jar - Java Eclipse Netbeans Tutorial

Published on 2013-01-19 05:40:00

If you have tried creating JAR file and running Java program form command line you may have encountered "Failed to load Main-Class manifest attribute from jar" , This error which haunts many Java programmer when they enter into command line arena and

How to setup JNDI Database Connection pool in Tomcat - Spring Tutorial Example

Published on 2013-01-18 07:14:00

Setting JNDI Database Connection pool in Spring and Tomcat is pretty easy. Tomcat server documentation gives enough information on how to setup connection pool in Tomcat 5, 6 or 7. Here we will use Tomcat 7 along with spring framework for creating co

How to check if a Number is Positive or Negative in Java - Interview Question

Published on 2013-01-16 19:37:00

Write a Java program to check if a number is positive or negative is one of the popular Java coding interview question, it may look easy but programmers often fumble on this question. One of the tricky part of this question is that Java has multiple

ThreadLocal Memory Leak in Java web application - Tomcat

Published on 2013-01-14 07:00:00

ThreadLocal variables are infamous for creating memory leaks. A memory leak in Java is amount of memory hold by object which are not in use and should have been garbage collected, but because of unintended strong references, they still live in Java h

How to decompile class file in Java and Eclipse - Javap command example

Published on 2013-01-11 23:44:00

Ability to decompile a Java class file is quite helpful for any Java developer who wants to look into the source of any open source or propriety library used in project. Though I always prefer to attach source in Eclipse of most common libraries like

Difference between Sun (Oracle) JVM and IBM JVM

Published on 2013-01-10 07:10:00

There are different JVM implementation available apart form popular Sun's (now Oracle) hotspot JVM like IBM's JVM. Now question comes, what makes two JVM different to each other? Quite a lot of thing can be different even if two JVMs are impl

Java Best Practices to Follow while Overloading Method and Constructor

Published on 2013-01-07 09:01:00

Method overloading in Java needs to be use carefully. Poorly overloaded method add not only add confusions among developers who use that but also they are error prone and leaves your program on compiler's mercy to select proper method. It's b

Top 5 Java programming books - Best of lot

Published on 2013-01-06 07:31:00

These top Java programming books are very good Java books and I would say best of lot. Whenever a programmer starts learning Java first question he ask is "Which Java books should I refer for learning?", That itself says, how important Java books are

10 XML Interview questions and answers for Java Programmer

Published on 2013-01-05 03:52:00

XML Interview questions are very popular in various programming job interviews, including Java interviews for web developer. XML is a matured technology and often used as standard for transporting data from one platform other. XML Interview questions

What is NavigableMap in Java 6 - Creating subMap from Map with Example

Published on 2013-01-04 09:38:00

NavigableMap in Java 6 is an extension of SortedMap  like TreeMap which provides convenient navigation method like lowerKey, floorKey, ceilingKey and higherKey. NavigableMap is added on Java 1.6 and along with these popular navigation method it also

Difference between Factory and Abstract Factory design pattern in Java

Published on 2013-01-03 07:12:00

Both Abstract Factory and Factory design pattern are creational design pattern and use to decouple clients from creating object they need, But there is a significant difference between Factory and Abstract Factory design pattern, Factory design patte

JDBC Batch INSERT and UPDATE example in Java with PreparedStatement

Published on 2013-01-02 06:08:00

JDBC API in Java allows program to batch insert and update data into database, which tends to provide better performance by simple virtue of fact that it reduce lot of database round-trip which eventually improves overall performance. In fact it’s

Data Access Object (DAO) design pattern in Java - Tutorial Example

Published on 2013-01-01 06:27:00

Data Access Object or DAO design pattern is a popular design pattern to implement persistence layer of Java application. DAO pattern is based on abstraction and encapsulation design principles and shields rest of application from any change on persis

Top 10 Oracle Interview Question and Answer - Database and SQL

Published on 2012-12-31 04:58:00

These are some interview question and answer asked during my recent interview. Oracle interview questions are very important during any programming job interview. Interviewer always want to check how comfortable we are with any database either we go

How to compare Arrays in Java – Equals vs deepEquals Example

Published on 2012-12-30 06:47:00

java.util.Arrays class provides equals() and deepEquals() method to compare two Arrays in Java. Both of these are overloaded method to compare primitive arrays e.g. int, long, float, double and Object arrays e.g. Arrays.equals(Object[] , Object[]). A

How to append text into File in Java – FileWriter Example

Published on 2012-12-29 23:15:00

Some times we need to append text into File in Java instead of creating new File. Thankfully Java File API is very rich and it provides several ways to append text into File in Java. Previously we have seen how to create file and directory in Java an

Difference between equals method and "==" operator in Java - Interview Question

Published on 2012-12-29 20:15:00

Both equals() and "==" operator in Java is used to compare objects to check equality but main difference between equals method and  == operator is that former is method and later is operator. Since Java doesn’t support operator overloading, == beh

How to add, subtract days, months, years, hours from Date and Time in Java

Published on 2012-12-29 09:21:00

Adding days, hours, month or years to dates is a common task in Java. java.util.Calendar can be used to perform Date and Time arithmetic in Java. Calendar class not only provides date manipulation but it also support time manipulation i.e. you can ad

Difference between Primary key vs Foreign key in table – SQL database tutorial

Published on 2012-12-29 03:09:00

Main difference between Primary key and Foreign key in a table is that, it’s the same column which behaves as primary key in parent table and as foreign key in child table. For example in Customer and Order relationship, customer_id is primary key

java.lang.classcastexception cannot be cast to in Java - cause and solution

Published on 2012-12-28 23:38:00

As name suggests ClassCastException in Java comes when we try to type cast an object and object is not of the type we are trying to cast into. In fact ClassCastException in Java is one of most common exception in Java along with java.lang.OutOfMemory

Difference between Class and Object in Java and OOPS with Example

Published on 2012-12-28 22:51:00

Class and Object are two most important concept of Object oriented programming language (OOPS)  e.g. Java. Main difference between a Class and an Object in Java is that class is a blueprint to create different objects of same type. This may looks si

How to attach source in eclipse for Jars, debugging and code look-up – JDK Example

Published on 2012-12-28 07:13:00

Attaching source of any Jar in Eclipse e.g. JDK or open source libraries like Spring framework is good idea because it help during debugging and code development. As a Java programmer at least you should attach source of JDK in Eclipse IDE to find ou

How to find middle element of LinkedList in Java in one pass

Published on 2012-12-28 03:52:00

How do you find middle element of LinkedList in one pass is a programming question often asked to Java and non Java programmers in telephonic Interview. This question is similar to checking palindrome or calculating factorial, where Interviewer some

Recursion in Java with example – Programming Techniques Tutorial

Published on 2012-12-28 00:19:00

Recursion is one of the tough programming technique to master. Many programmers working on both Java and other programming language like C or C++ struggles to think recursively and figure out recursive pattern in problem statement, which makes it is

What is Referential Integrity in Database or SQL - MySQL Example Tutorial

Published on 2012-12-27 23:00:00

Referential Integrity is set of constraints applied to foreign key which prevents entering a row in child table (where you have foreign key) for which you don't have any corresponding row in parent table i.e. entering NULL or invalid foreign keys

How to create thread safe Singleton in Java - Java Singleton Example

Published on 2012-12-27 21:18:00

Thread safe Singleton means a Singleton class which returns exactly same instance even if exposed to multiple threads. Singleton in Java has been a classical design pattern like Factory method pattern or Decorator design pattern and has been used a l

Oracle Pagination SQL query example for Java programmer

Published on 2012-12-27 09:00:00

Many time we need SQL query which return data page by page i.e. 30 or 40 records at a time, which can be specified as page size. In fact Database pagination is common requirement of Java web developers, especially dealing with largest data sets.  In

How to convert milliseconds to Date in Java - tutorial example

Published on 2012-12-27 07:52:00

Do you want to convert milliseconds to Date in Java ? Actually java.util.Date is internally specified in milliseconds from epoch. So any date is number of millisecond passed since January 1, 1970, 00:00:00 GMT and Date provides constructor which can

3 Example to print array values in Java - toString and deepToString from Arrays

Published on 2012-12-27 03:32:00

Printing array values in Java or values of array element in Java would have been much easier if  arrays are allowed to directly prints its values whenever used inside System.out.println() or format and printf method, Similar to various classes in Ja

How to check if a number is a palindrome or not in Java - Example

Published on 2012-12-26 23:05:00

How to check if a number is a palindrome or not is a variant of  popular String interview question how to check if a String is a palindrome or not. A number is said to be a palindrome if number itself is equal to reverse of number e.g. 313 is a pali

Inner class and nested Static Class in Java with Example

Published on 2012-12-26 21:37:00

Inner class and nested static class in Java both are classes declared inside another class, known as top level class in Java. In Java terminology, If you declare a nested class static, it will called nested static class in Java while non static neste

SQL query to add, modify and drop column in table with default value NOT NULL constraint – MySQL database

Published on 2012-12-26 08:24:00

How to add column in existing table with default value is another popular SQL interview question asked for Junior level programming job interviews. Though syntax of SQL query to add column with default value varies little bit from database to databas

What is Type Casting in Java - Casting one Class to other class or interface Example

Published on 2012-12-26 02:34:00

Type casting in Java is to cast one type, a class or interface, into another type i.e. another class or interface. Since Java is an Object oriented programming language and supports both Inheritance and Polymorphism, It’s easy that Super class refe

How to create auto incremented identity column in SQL Server, MySQL, Sybase and Oracle ?

Published on 2012-12-25 23:22:00

Automatic incremented ID, Sequence or Identity columns are those columns in any table whose value is automatically incremented by database based upon predefined rule. Almost all databases e.g. Microsoft SQL Server, MySQL, Oracle or Sybase supports au

How to convert String to long in Java - 4 Examples

Published on 2012-12-25 21:39:00

How to convert string to long in Java is one of those frequently asked questions by beginner who has started learning Java programming language and not aware of how to convert from one data type to another. Converting String to long is similar to con

How to fix java.io.NotSerializableException: org.apache.log4j.Logger Error in Java

Published on 2012-12-25 09:39:00

java.io.NotSerializableException: org.apache.log4j.Logger error says that instance of org.apache.lo4j.Logger is not Serializable. This error comes when we use log4j for logging in Java and create Logger in a Serializable class e.g. any domain class o

How to initialize List with Array in Java - One Liner Example

Published on 2012-12-25 06:59:00

Initializing list while declaring it is very convenient for quick use. If you have been using Java programming language for quite some time then you must be familiar with syntax of array in Java and how to initialize an array in the same line while d

How to create and evaluate XPath Expression in Java:

Published on 2012-12-25 02:26:00

You can use XPathExpression from javax.xml.xpath package to create and execute XPATH expression in Java.  Java API provides javax.xml.xpath  package, which contains classes like Xpath, XpathFactory to work with XPATH and XML documents. By the way t

Sybase and SQL Server PATINDEX CHARINDEX Example to split String in Stored procedure

Published on 2012-12-24 23:16:00

Some time we need to split a long comma separated String in Stored procedure  e.g. Sybase or SQL Server stored procedures. Its quite common to pass comma delimited or delimiter separated String as input parameter to Stored procedure and than later s

How to get current date, month, year and day of week in Java program

Published on 2012-12-24 20:56:00

Here is quick Java tip to get current date, month, year and day of week from Java program. Java provides a rich Date and Time API though having thread-safety issue but its rich in function and if used locally can give you all the date and time inform

How to create and modify Properties file form Java program in Text and XML format

Published on 2012-12-24 07:04:00

Though most of the time we create and modify properties file using text editor like notepad, word-pad or edit-plus, It’s also possible to create and edit properties file from Java program. Log4j.properties, which is used to configure Log4J based lo

How to count occurrence of a character in String - Java programming exercise

Published on 2012-12-24 05:26:00

Write a program to count number of occurrence of a character in String is one of common programming interview question not just in Java but also in other programming language like C or C++.  As String in a very popular topic on programming interview

How to read input from command line in Java using Scanner

Published on 2012-12-24 02:27:00

Java 5 introduced a nice utility called java.util.Scanner which is capable to read input form command line in Java. Using Scanner is nice and clean way of retrieving user input from console or command line. Scanner can accept InputStream, Reader or s

How to remove duplicates elements from ArrayList in Java

Published on 2012-12-23 03:31:00

You can remove duplicates or repeated elements from ArrayList in Java by converting ArrayList into HashSet in Java. but before doing that just keep in mind that Set doesn't preserver insertion order which is guaranteed by List, in fact that’s t

How to find second highest or maximum salary of Employee in SQL - Interview question

Published on 2012-12-22 21:40:00

How to find second highest or second maximum salary of an Employee is one of the most frequently asked SQL interview question similar to finding duplicate records in table and when to use truncate vs delete. There are many ways to find second highest

XPath Tutorial - How to select elements in XPATH based on attribute and element value example

Published on 2012-12-22 07:10:00

In this XPATH tutorial we will see example of selecting elements based upon its value or attribute value. We will see how to select between two elements based upon value of its child elements or based upon value of its attribute. XPATH is an importan

Constructor Chaining in Java - Calling one constructor from another using this and super

Published on 2012-12-22 03:27:00

Constructor Chaining in Java In Java you can call one constructor from another and it’s known as constructor chaining in Java. Don’t confuse between constructor overloading and constructor chaining, former is just a way to declare more than one

How to escape text when pasting as String literal in Eclipse Java editor

Published on 2012-12-21 23:22:00

Whenever you paste String in Eclipse which contains escape characters,  to store in a String variable or just as String literal it will ask to manually escape special characters like single quotes, double quotes, forward slash etc. This problem is m

Invalid initial and maximum heap size in JVM - How to fix

Published on 2012-12-21 08:17:00

I was getting "Invalid initial heap size: -Xms=1024M" while starting JVM and even after changing maximum heap size from 1024 to 512M it keep crashing by telling "Invalid initial heap size: -Xms=512m , Could not create the Java virtual machine" , I ch

SQL query to copy, duplicate or backup table in MySQL, Oracle and PostgreSQL database

Published on 2012-12-20 07:01:00

Many times we need to create backup or copy of tables in database like MySQL, Oracle or PostgreSQL while modifying table schema like adding new columns, modifying column or dropping columns. Since its always best to have a backup of table which can b

How to sort HashMap by key and value in Java - Example Tutorial

Published on 2012-12-19 06:02:00

Sorting HashMap in Java is not as easy as it sounds because unfortunately Java API doesn't provide any utility method to sort HashMap based on keys and values. Sorting HashMap is not like sorting ArrayList or sorting Arrays in Java. If you are wo

Does Java pass by value or pass by reference - Interview Question

Published on 2012-12-18 07:57:00

Does Java is pass by value or pass by reference is one of the tricky Java question mostly asked on fresher level interviews. Before debating whether Java is pass by value or pass by reference lets first clear what is pass by value and what is pass by

Mapping network drive in Windows XP and 7 – net use command Example

Published on 2012-12-17 07:25:00

Mapping network drive in Windows XP or Windows 7 is much easier and faster by using command line than by doing it on Windows explorer. If you have been working in Windows environment with bunch of Windows 2000 or 2003 servers and your job requires fr

Inversion of Control and Dependency Injection design pattern with real world Example - Spring tutorial

Published on 2012-12-15 09:29:00

Inversion of Control and Dependency Injection is a core design pattern of Spring framework. IOC and DI design pattern is also a popular design pattern interview question in Java. As name suggest Inversion of control pattern Inverts responsibility of

'javac' is not recognized as an internal or external command - cause and solution

Published on 2012-12-15 02:30:00

So you are trying to compile your Java source file and getting "'javac' is not recognized as an internal or external command". If this is your first Java program or HelloWorld than I suggest to go through How to compile and run HelloWorld in Java bec

How to find duplicate records in a table on database - SQL tips

Published on 2012-12-14 07:26:00

How to find duplicate records in table is a popular SQL interview question which has been asked as many times as difference between truncate and delete in SQL or finding second highest salary of employee. Both of these SQL queries are must know for a

java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver - cause and solution

Published on 2012-12-13 06:40:00

java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver Exception comes when you try to connect Oracle database from Java program and Oracle driver is not available in Classpath. We have already seen How to connect Oracle database from Java

What is Constructor in Java with Example – Constructor Chaining and Overloading

Published on 2012-12-12 06:24:00

What is constructor in Java Constructor in Java is block of code which is executed at the time of Object creation. But other than getting called, Constructor is entirely different than methods and has some specific properties like name of constructo

Eclipse shortcut to comment uncomment single line and block of code - Eclipse Tips Tricks

Published on 2012-12-11 05:47:00

Knowing Eclipse shortcut to comment and uncomment single line or block of code can save you lot of time while working in Eclipse. In fact I highly recommend every Java programmer to go through these top 30 Eclipse shortcut and  10 java debugging tip

Union and Intersection of two Set in Java - Google Guava Example

Published on 2012-12-10 06:50:00

Google Guava is an open source library which provides lots of useful utility to Java programmer,  one of them is easy way to find intersection and union of two Set in Java. You might have used Google Guava for other functionality e.g. for overriding

How ClassLoader Works in Java

Published on 2012-12-08 05:55:00

ClassLoader in Java works on three principle: delegation, visibility and Uniqueness. Delegation principle forward request of class loading to Parent class loader and only loads the class if parent is not able to locate or load class. Visibility pr

Top 10 JDBC Interview questions answers for Java programmer

Published on 2012-12-07 07:12:00

JDBC Interview Question and Answer JDBC Questions are integral part of any Java interview,  I have not seen any Java Interview which is completed without asking single JDBC Interview question, there are always at least one or two question from JDBC

What is Object in Java or OOPS - Example Tutorial

Published on 2012-12-06 08:45:00

Object in Java Object in Java programming language or any other Object oriented programming language like C++ are core of OOPS concept and that's why the name. Class and Object along with Inheritance, Polymorphism, Abstraction and Encapsulatio

Blocking Queue in Java – ArrayBlockingQueue vs LinkedBlockingQueue Example program Tutorial

Published on 2012-12-05 07:43:00

BlockingQueue in Java is added in Java 1.5 along with various other concurrent Utility classes like ConcurrentHashMap, Counting Semaphore, CopyOnWriteArrrayList etc. BlockingQueue is a unique collection type which not only store elements but also sup

Why getter and setter are better than public fields in Java

Published on 2012-12-04 07:55:00

public modifier vs getter and setter method in Java Providing getter and setter method for accessing any field of class in Java may look unnecessary and trivial at first place, simply because you can make field public and it’s accessible from ever

What is difference between BeanFactory and ApplicationContext in Spring framework

Published on 2012-11-23 07:33:00

BeanFactory vs ApplicationContext Difference between BeanFactory and ApplicationContext in Spring framework is a another frequently asked Spring interview question mostly asked to Java programmers with 2 to 4 years experience in Java and Spring. Bot

How to join three tables in SQL query – MySQL Example

Published on 2012-11-22 08:48:00

Three table JOIN Example SQL Joining three tables in single SQL query can be very tricky if you are not good with concept of SQL Join. SQL Joins have always been tricky not only for new programmers but for many others,  who are in programming and S

Difference between Setter Injection vs Constructor Injection in Spring framework

Published on 2012-11-19 00:47:00

Spring Setter vs Constructor Injection Spring supports two types of dependency Injection, using setter method e.g. setXXX() where XXX is dependency or via constructor argument. First way of dependency injection is known as setter injection while lat

Difference between TreeSet, LinkedHashSet and HashSet in Java with Example

Published on 2012-11-07 21:31:00

TreeSet, LinkedHashSet and HashSet all are implementation of Set interface and by virtue of that, they follows contract of Set interface i.e. they do not allow duplicate elements. Despite being from same type hierarchy,  there are lot of difference

Difference between final, finally and finalize method in Java

Published on 2012-11-06 08:22:00

What is difference between final, finally and finalize method is asked to my friend in a Java interview with one of the US based Investment bank. Though it was just a telephonic round interview, he was asked couple of good questions e.g. how to avoid

4 ways to search Java Array to find an element or object - Tutorial Example

Published on 2012-11-04 04:12:00

Searching in Java Array sounds familiar? should be,  because its one of frequently used operations in Java programming. Array is an index based data structure which is used to store elements but unlike Collection classes like ArrayList or HashSet wh

Why use @Override annotation in Java - Coding Best Practice

Published on 2012-11-03 06:12:00

@Override annotation was added in JDK 1.5 and it is used to instruct compiler that method annotated with @Override  is an overridden method from super class or interface. Though it may look trivial @Override is particularly useful while overriding

Prefer TimeUnit Sleep over Thread.Sleep - Java Coding Tips

Published on 2012-11-03 01:17:00

What is TimeUnit in JavaTimeUnit in Java is a class on java.util.concurrent package, introduced in Java 5 along with CountDownLatch, CyclicBarrier, Semaphore and several other concurrent utilities. TimeUnit provides a human readable version of Thread

What is static import in Java 5 with Example

Published on 2012-10-29 09:14:00

Static import in Java allows to import static members of class and use them, as they are declared in the same class. Static import is introduced in Java 5 along with other features like Generics, Enum, Autoboxing and Unboxing and variable argument methods. Many programmer think that using static import can reduce code size and allow you to freely use static field of external class without prefixing class name on that. For example without static import you will access static constant MAX_VALUE of [..]

What is difference between java.sql.Time, java.sql.Timestamp and java.sql.Date - JDBC interview Question

Published on 2012-10-27 22:41:00

Difference between java.sql.Time, java.sql.Timestamp and java.sql.Date  is most common JDBC question appearing on many core Java interviews. As JDBC provides three classes java.sql.Date, java.sql.Time and java.sql.Timestamp to represent date and time and you already have java.util.Date which can represent both date and time, this question poses lot of confusion among Java programmer and that’s why this is one of those tricky Java questions which is tough to answer. It becomes really tough if [..]

JSTL foreach tag example in JSP - looping ArrayList

Published on 2012-10-27 00:05:00

JSTL  foreach loop in JSP JSTL  foreach tag is pretty useful while writing Java free JSP code.  JSTL foreach tag allows you to iterate or loop Array List, HashSet or any other collection without using Java code. After introduction of JSTL and expression language(EL) it is possible to write dynamic JSP code without using scriptlet which clutters jsp pages. JSTL foreach tag is a replacement of for loop and behaves similarly like foreach loop of Java 5 but still has some elements and attribut [..]

Eclipse shortcut to System.out.println in Java program - Tips

Published on 2012-10-25 07:51:00

Eclipse IDE provides quick shortcut keys to print System.out.println statement in Java but unfortunately not every Java programmers are familiar of that.  Even programmers with 3 to 4 year of experience sometime doesn't know this useful Eclipse shortcut to generate System.out.println messages.  This Eclipse tips is to help those guys. Let me ask you one question, How many times you type System.out.println in your Java program?  I guess multiple time,  while doing programming, debugging a [..]

Java program to calculate area of Triangle - Homework, programming exercise example

Published on 2012-10-25 04:43:00

Calculate area of Triangle in Java Write a Java program to calculate Area of Triangle, accept input from User and display output in Console is one of the frequently asked homework question. This is not a tough programming exercise but a good exercise for beginners and anyone who has started working in Java. For calculating area of triangle using formula 1/2(base*height), you need to use arithmetic operator. By doing this kind of exercise you will understand how arithmetic operators works in Jav [..]

Difference between notify and notifyAll in Java - When and How to use

Published on 2012-10-23 09:47:00

notify vs notifyAll in Java What is difference between notify and notifyAll method is one of the tricky Java question, which is easy to answer but once Interviewer ask followup questions, you either got confused or not able to provide clear cut and to the point answers. Main difference between notify and notifyAll is that notify method will only notify one Thread and notifyAll method will notify all Threads  which are waiting on that monitor or lock. By the way this is something you have bee [..]

5 ways to add multiple JAR in to Classpath in Java

Published on 2012-10-21 00:49:00

How to add JAR file to Classpath in Java Adding JAR into classpath is a common task for Java programmer and different programmer do it on different way. Since Java allows multiple ways to include JAR file in classpath, it becomes important to know pros and cons of each approach and How exactly they work. There are 5 ways to add  jars on into classpath in Java some of them we have already seen in  How classpath works in Java and How to set Path in Java. In this post we will revisit some of th [..]

Regular Expression in Java to check numbers in String - Example

Published on 2012-10-20 01:12:00

Regular Expression to check numeric String In order to build a regular expression to check if String is number or not or if String contains any non digit character or not you need to learn about character set in Java regular expression, Which we are going to see in this Java regular expression example. No doubt Regular Expression is great tool in developer arsenal and familiarity or some expertise with regular expression can help you a lot. Java supports regular expression using java.util.regex [..]

Difference between private, protected, public and package modifier in Java

Published on 2012-10-19 08:06:00

private vs public vs protected vs package in Java Java has four access modifier namely private, protected and public. package level access is default access level provided by Java  if no access modifier is specified. These access modifier is used to restrict accessibility of a class, method or variable on which it applies. We will start from private access modifier which is most restrictive access modifier and then go towards public which is least restrictive access modifier, along the way we [..]

10 Garbage Collection Interview Questions and Answers

Published on 2012-10-17 00:41:00

GC Interview Questions Answer in Java Garbage collection interview questions are very popular in both core Java and advanced Java Interviews. Apart from  Java Collection and Thread  many tricky Java questions stems Garbage collections which are tough to answer. In this Java Interview article I will share some questions from GC which is asked in various core Java interviews.These questions are based upon concept of How Garbage collection works, Different kinds of Garbage collector and JVM para [..]

Java Program to get input from User - Example Tutorial Code

Published on 2012-10-14 01:02:00

How to get input from user in Java from command line is the common thing every one started learning Java looks for. It’s second most popular way of starting programming after HelloWorld in Java. There are so many ways to get input from User in Java including command line and Graphical user interface. For beginner simpler the example, better it is. first and foremost way of getting input from user is String[] passed to main method in Java but that only work for one time requirement and its not [..]

Eclipse shortcut to remove all unused imports in Java file

Published on 2012-10-12 23:32:00

How to remove all unused imports in Eclipse Eclipse IDE gives warning "The import XXX is never used" whenever it detect unused import in Java source file and shows a yellow underline. Though unused import in Java file does not create any harm, its unnecessary increase length and size of Java source file and if you have too many unused imports in your Java source file, those yellow underline and Eclipse warning affect readability and working. In our last post on Eclipse, we have seen dome Java d [..]

10 Java String interview Question answers - Advanced

Published on 2012-10-07 02:02:00

10 Java String interview Question answers String interview questions in Java is one of Integral part of any Core Java or J2EE interviews. No one can deny importance of String and How much it in any Java application irrespective of whether its core Java desktop application, web application, Enterprise application or Mobile application. String is one of the fundamental of Java programming language and correct understanding of String class is must for any Java programmer. What makes String intervi [..]

What is Inheritance in Java and OOPS Tutorial - Example

Published on 2012-10-06 04:03:00

Inheritance in Java is an Object oriented or  OOPS concepts, which allows to emulate real world Inheritance behavior, Inheritance allows code reuse in Object oriented programming language e.g. Java. Along with Abstraction, Polymorphism and Encapsulation, Inheritance forms basis of Object oriented programming. Inheritance is implemented using extends keyword in Java and When one Class extends another Class it inherit all non private members including fields and methods. Inheritance in Java can b [..]

Difference between EnumMap and HashMap in Java

Published on 2012-09-30 20:06:00

HashMap vs EnumMap in Java What is difference between EnumMap and HashMap in Java is the latest Java collection interview question which has been asked to couple of my friends. This is one of the tricky Java question, specially if you are not very much familiar with EnumMap in Java, which is not uncommon, given you can use it with only Enum keys. Main difference between EnumMap and HashMap is that EnumMap is a specialized Map implementation exclusively for Enum as key. Using Enum as key, allows [..]

Difference between trustStore and keyStore in Java - SSL

Published on 2012-09-29 23:03:00

trustStore vs keyStore in Java trustStore and keyStore are used in context of setting up SSL connection in Java application between client and server. TrustStore and keyStore are very much similar in terms of construct and structure as both are managed by keytool command and represented by KeyStore programatically but they often confused Java programmer both beginners and intermediate alike. Only difference between trustStore and keyStore is what they store and there purpose. In SSL handshake p [..]

10 Tips to override toString() method in Java - ToStringBuilder Netbeans Eclipse

Published on 2012-09-23 00:23:00

Java toString method toString method in Java is used to provide clear and concise information about Object in human readable format. Correctly overridden toString method can help in logging and debugging of Java program by providing valuable and meaningful information. Since toString() is defined in java.lang.Object class and its default implementation doesn't provide much information, its always a best practice to override toString method in sub class. In fact if you are creating value cla [..]

How to determine Type of object at runtime in Java - Runtime Type Identification

Published on 2012-09-22 00:26:00

Runtime Type identification in Java Determining Type of object at runtime in Java means finding what kind of object it is. For those who are not familiar with What is a Type in Java,  Type is the name of class e..g for “abc” which is a String object, Type is String. Finding Type of any object at runtime is  also known as Runtime Type Identification in Java. Determining Type becomes increasingly important for method which accept parameter of type java.lang.Object like compareTo method of C [..]

What is EnumMap in Java – Example Tutorial

Published on 2012-09-16 04:07:00

What is EnumMap in Java EnumMap in Java is added on JDK  5 release along with other important features like  Autoboxing, varargs and Generics. EnumMap is specialized Map implementation designed and optimized for using Java Enum as key. Since enum can represent a type (like class or interface)  in Java and it can also override equals() and hashCode() , It can be used inside HashMap or any other collection but using  EnumMap brings implementation specific benefits which is done for enum keys, [..]

Difference between save vs persist and saveOrUpdate in Hibernate

Published on 2012-09-14 23:50:00

Save vs saveOrUpdate vs persist in Hibernate What is difference between save and saveOrUpdate or Difference between save and persist are common interview question in any Hibernate interview, much like Difference between get and load method in Hibernate. Hibernate Session class provides couple of ways to save object into database by methods like save, saveOrUpdate and persist.  You can use either save(),  saveOrUpdate() or persist() based upon your requirement for persisting object into Databa [..]

How to replace escape XML special characters in Java String

Published on 2012-09-02 01:09:00

How to replace XML special Characters in Java String There are two approaches to replace XML or HTML special characters from Java String, First,  Write your own function to replace XML special characters or use any open source library which has already implemented it. Luckily there is one very common open source library which provides function to replace special characters from XML String is Apache commons lang’s StringEscapeUtils class which provide escaping for several  languages like XML [..]

Java program to find IP Address of localhost - Example Tutorial

Published on 2012-09-01 03:59:00

How to find IP address of local host from Java program Java networking API provides method to find IP address of localhost from Java program by using java.net. InetAddress class. It’s rare when you need IP address for localhost in Java program. Mostly I used Unix command to find IP address of localhost. For all practical purpose where program doesn’t need IP address but you need to troubleshoot any networking issues, Use DOS or windows command or Use Linux commands. Recently one of my frien [..]

Top 10 JDBC Best Practices for Java Programmer

Published on 2012-08-28 08:31:00

Java JDBC Best practices JDBC Best Practices are some coding practices which Java programmer should follow while writing JDBC code. As discussed in how to connect to Oracle database from Java, JDBC API is used to connect and interact with a Database management System.  We have touched some of the JDBC best practices in our last article 4 JDBC Performance tips, On which we have discussed simple tips to improve performance of Java application with database. By using JDBC you can execute DDL, DML [..]

How to delete empty files directories in Unix Linux

Published on 2012-08-24 23:51:00

Deleting empty file and directory in Unix Many times we need to find and delete empty files or directories in UNIX/Linux. Since there is no single command in Unix/Linux which allows you to remove empty files or empty directories rather we need to rely on find command and xargs command. In this UNIX and linux example we will see How to delete empty files and directories. Before removing empty files and directories we need to find those files and there are lots of option available to search for e [..]

How to Convert Collection to String in Java - Spring Framework Example

Published on 2012-08-23 09:15:00

How to convert Collection to String in Java Many times we need to convert any Collection like Set or List into String like comma separated or any other delimiter delimited String. Though this is quite a trivial job for a Java programmer as you just need to Iterate through loop and create a big String where individual String are separated by delimiter, you still need to handle cases like last element should not have delimiter or at bare minimum you need to test that code. I like Joshua Bloach ad [..]

How to write parametrized class and method in Java – Generics Example

Published on 2012-08-18 07:35:00

Parametrized class and method in Java Writing Generic parametrized class and method in Java is easy and should be used as much as possible. Generic in Java was introduced in version 1.5  along with Autoboxing, Enum, varargs and static import. Most of the new code development in Java uses type-safe Generic collection i.e. HashSet in place of HashSet but still Generic is underused in terms of writing own parametrized classes and method. I agree that most Java programmers has started using Generi [..]

What is JSESSIONID in J2EE Web application - JSP Servlet?

Published on 2012-08-12 08:38:00

What is JSESSIONID in JSP ServletJSESSIONID is a cookie generated by Servlet container like Tomcat or Jetty and used for session management in J2EE web application for http protocol. Since HTTP is a stateless protocol there is no way for Web Server to relate two separate requests coming from same client and Session management is the process to track user session using different session management techniques like Cookies and URL Rewriting. If Web server is using cookie for session management it c [..]

Best Practices to write JUnit test cases in Java

Published on 2012-08-11 06:03:00

JUnit best practices in JavaNo doubt writing good JUnit test cases is a rare skill just like writing good Code. A good, well thought and well written JUnit test can prevent several production issues during initial development or later maintenance in Java application. Though one can only be perfect in writing JUnit test by practice and a level of business knowledge which is important to envision different scenarios on which a method gets called, some best practices or experience of other develope [..]

How to format String in Java – printf Example

Published on 2012-08-08 08:52:00

String format and printf ExampleHow to format String in Java is most common problem developer encounter because classic System.out.println() doesn’t support formatting of String while printing on console. For those who doesn’t  know What is formatted String ? here is a simple definition,  Formatted String is a String which not only display contents but also display it in a format which is widely accepted like including comma while displaying large numbers e.g. 100,000,000 etc. Displaying f [..]

How to get environment variables in Java- Example Tutorial

Published on 2012-08-06 09:14:00

Environment variables in JavaThere are two ways to get environment variable in Java, by using System properties or by using System.getEnv(). System properties provides only limited set of predefined environment variables like java.classpath, for retriving Java Classpath or java.username

5 ways to convert InputStream to String in Java

Published on 2012-08-04 01:13:00

InputStream to String Conversion Example Converting InputStream to String in Java has become very easy after introduction of Scanner class in Java 5 and due to development of several open source libraries like Apache commons IOUtils and Google Open source guava-libraries which provides excellent support to convert InputStream to String in Java program. we often need to convert InputStream to String  while working in Java for example if you are reading XML files from InputStream and later perfo [..]

How to create read only List, Map and Set in Java – unmodifiable example

Published on 2012-07-31 09:42:00

Read only List, Map and Set in Java Read only List means a List where you can not perform modification operations like add, remove or set. You can only read from the List by using get method or by using Iterator of List, This kind of List is good for certain requirement where parameters are final and can not be changed. In Java you can use Collections.unModifiableList() method  to create read only List , Collections.unmodifiableSet() for creating read-only Set like read only HashSet and simila [..]

CountDownLatch Example in Java - Concurrency Tutorial

Published on 2012-07-29 00:53:00

Java CountDownLatch ExampleCountDownLatch in Java is a kind of synchronizer which allows one Thread  to wait for one or more Threads before starts processing. This is very crucial requirement and often needed in server side core Java application and having this functionality built-in as CountDownLatch greatly simplifies the development. CountDownLatch in Java is introduced on Java 5 along with other concurrent utilities like CyclicBarrier, Semaphore, ConcurrentHashMap and BlockingQueue in java. [..]

CyclicBarrier Example in Java 5 – Concurrency Tutorial

Published on 2012-07-28 04:05:00

Java CyclicBarrier Tutorial and Example CyclicBarrier in Java is a synchronizer introduced in JDK 5 on java.util.Concurrent package along with other concurrent utility like Counting Semaphore, BlockingQueue, ConcurrentHashMap etc. CyclicBarrier is similar to CountDownLatch which we have seen in last article and allows multiple threads to wait for each other (barrier) before proceeding. Also difference between CoundDownLatch and CyclicBarrier is a also very popular multi-threading interview ques [..]

When a class is loaded and initialized in JVM - Java

Published on 2012-07-25 09:21:00

Classloading and initialization in Java Understanding of when a class is loaded and initialized in JVM is one of the fundamental concept of Java programming language. Thanks to Java language specification we have everything clearly documented and explained, but many Java programmer still doesn't know when a class is loaded or when a class is initialized in Java. Class loading and initialization seems confusing and complex to many beginners and its true until having some experience in belt i [..]

How to read file line by line in Java - BufferedReader Scanner Example Tutorial

Published on 2012-07-23 10:10:00

Line by Line reading in Java using BufferedReader and Scanner There are multiple ways to read file line by line in Java. Most simple example of reading file line by line is using BufferedReader which provides method readLine() for reading file. Apart from generics, enum and varargs Java 1.5  has also introduced several new class in Java API one of the  utility class is Scanner, which can also be used to read any file line by line in Java. Though BufferedReader is available in Java from JDK 1. [..]

Difference between get and load in Hibernate

Published on 2012-07-21 07:35:00

get vs load in Hibernate Difference between get and load method in Hibernate is a one of the most popular question asked in Hibernate and spring interviews. Hibernate Session  class provides two method to access object e.g. session.get() and session.load() both looked quite similar to each other but there are subtle difference between load and get method which can affect performance of application. Main difference between get() vs load method is that get() involves database hit if object doesn [..]

Auto boxing and Unboxing in Java – Be careful while using

Published on 2012-07-18 07:55:00

Auto boxing in Java Auto boxing and un-boxing is introduced in Java 1.5 to automatically convert primitive type into boxed primitive( Object or Wrapper class) in Java. If you have been using Collections like HashMap or ArrayList before Java 1.5 then you are familiar with the issue that you can not directly put primitives into Collections, instead you first need to convert them in to Object only then you can put them into Collections. Wrapper class like Integer, Double and Boolean helps for conve [..]

Why Enum Singleton are better in Java

Published on 2012-07-14 00:51:00

Enum Singletons are new way to implement Singleton pattern in Java by using Enum with just one instance. Though Singleton pattern in Java exists from long time Enum Singletons are relatively new concept and in practice from Java 5 onwards after introduction of Enum as keyword and feature. This article is somewhat related to my earlier post on Singleton, 10 interview questions on Singleton pattern in Java where we have discussed common questions asked on interviews about Singleton pattern and 10 [..]

SubQuery Example in SQL – Correlated vs Noncorrelated

Published on 2012-07-08 01:07:00

SubQuery in SQL is a query inside another query. Some time to get a particular information from database you may need to fire two separate sql queries, subQuery is a way to combine or join them in single query. SQL query which is on inner part of main query is called inner query while outer part of main query is called outer query. for example in below sql query SELECT name FROM City WHERE pincode IN (SELECT pincode FROM pin WHERE zone='west') section not highlighted is OUTER query while section [..]

Builder Design pattern in Java - Example Tutorial

Published on 2012-06-30 00:34:00

Builder design pattern in Java is a creational pattern i.e. used to create objects, similar to factory method design pattern which is also creational design pattern. Before learning any design pattern I suggest find out the problem a particular design pattern solves. Its been well said necessity is mother on invention. learning design pattern without facing problem is not that effective, Instead if you have already faced issues than its much easier to understand design pattern and learn how its [..]

10 xargs command example in Linux - Unix tutorial

Published on 2012-06-28 09:14:00

xargs command in unix or Linux is a powerful command used in conjunction with find and grep command in UNIX to divide a big list of arguments into small list received from standard input. find and grep command produce long list of file names and we often want to either remove them or do some operation on them but many unix operating system doesn't accept such a long list of argument. UNIX xargs command divide that list into sub-list with acceptable length and made it work. This Unix tutorial [..]

What is -XX:+UseCompressedOops in 64 bit JVM

Published on 2012-06-25 01:04:00

-XX:+UseCompressedOops JVM command line option is one of the most talked option of 64 bit JVM. Though 64 bit JVM allows you to specify larger Java heap sizes it comes with a performance penalty by using 64 bit OOPS. Ordinary object pointers also known as OOPS which is used to represent Java objects in Virtual Machine has an increased width of 64 bit than smaller 32 bit from earlier 32 bit JVM. because of increased size of OOPS, fewer OOPS can be stored in CPU cache registers which effectively re [..]

HashSet in Java – 10 Examples Programs Tutorial

Published on 2012-06-24 00:43:00

HashSet in Java is a collection which implements Set interface and backed by an HashMap. Since HashSet uses HashMap internally it provides constant time performance for operations like add, remove, contains and size give HashMap has distributed elements properly among the buckets. Java HashSet does not guarantee any insertion orders of the set but it allows null elements. HashSet can be used in place of ArrayList to store the object if you require no duplicate and don't care about insertion [..]

JUnit4 Annotations : Test Examples and Tutorial

Published on 2012-06-23 01:19:00

JUnit4 Annotations are single big change from JUnit 3 to JUnit 4 which is introduced in Java 5. With annotations in Junit4,  creating and running a JUnit test becomes more easy and more readable, but you can only take full advantage of JUnit4 if you know the correct meaning of  JUnit 4 annotations and how to use them while writing JUnit tests. In thisJunit tutorial we will not only understand meaning of those annotations but also we will see examples of JUnit4 annotations. By the way this is m [..]

How to close Java program or Swing Application with Example

Published on 2012-06-18 09:10:00

In order to close Java program we need to consider which kind of Java application it is?, because termination of Java application varies between normal core java program to swing GUI application. In general all Java program terminates automatically once all user threads created by program finishes its execution, including main thread. JVM doesn't wait for daemon thread so as soon as last user thread finished, Java program will terminate. If you want to close or terminate your java applicatio [..]

JDBC Database connection pool in Spring Framework – How to Setup Example

Published on 2012-06-16 01:07:00

Setting up JDBC Database Connection Pool in Spring framework is easy for any Java application, just matter of changing few configuration in spring configuration file.If you are writing core java application and not running on any web or application server like Tomcat or  Weblogic,  Managing Database connection pool using Apache Commons DBCP and Commons Pool along-with Spring framework is nice choice but if you have luxury of having web server and managed J2EE Container, consider using Connecti [..]

Video Example of depth first search (DFS) and breadth first search (BFS) graph algorithm

Published on 2012-06-14 10:43:00

Breadth first Search (BFS) and Depth first search (DFS) algorithm are two most important graph and tree algorithm used for traversal. you can traverse all nodes of tree or graph by using BFS or DFS. Even though most of us learn about Breadth first search and depth first search in college its not easy to understand and it takes time to grasp the concept and I believe that once you understand how BFS or DFS works its easy to implement logic in Java or C++ but trying to implement or copy code witho [..]

10 Interview Questions on Java Generics for Programmer and Developers

Published on 2012-06-10 01:32:00

Generic interview questions in Java interviews are getting more and more common with Java 5 around there for considerable time and many application either moving to Java 5 and almost all new java development happening on Tiger(code name of Java 5).  Importance of Generics and Java 5 features like Enum, Collection utilities are getting more and more popular on Java interviews. Generic interview question can get real tricky if you are not familiar with bounded and unbounded generic wildcards, How [..]

Common cause of java.lang.NullPointerException in Java with Example

Published on 2012-06-09 08:27:00

NullPointerException in Java is probably the first Exception you will face in Java. It is true nightmare for beginners in Java but pretty easy to solve once you get familiar with Exception handling in Java. What makes NullPointerException little tricky is its name which has pointer in itself and Java does not support pointers like multiple inheritance in Java . In this article we will see What is NullPointerException in Java, How to solve Exception in thread "main" java.lang.NullPointerException [..]

How Breadth First Search Algorithm works - Java Program Example

Published on 2012-06-09 05:57:00

In this post I am going to tell you about the Breadth First Search Algorithm or BFS which is one of the useful search strategy used in searching a graph. The Breadth First search strategy has its main use in forming decision trees. The decision trees are used by the learning agent in the artificial intelligence to choose between the available options.Read more » Java, Unix, Tibco RV and FIX Protocol Tutorial

10 examples of Date command in Unix

Published on 2012-06-07 08:55:00

Date command in unix or Linux is one of important command to learn and master because we always need date information. no matter you want to know current date in unix or your bash script needs current date in unix for archiving purpose you need to use date command. In its simplest format date command shows the current date and time in unix while with sophisticated option we can extract many useful information from unix date command. In this Unix command tutorial  we will see some useful tips on [..]

20 Design pattern and Software design interview questions for Programmers

Published on 2012-06-03 03:24:00

Design patterns and software design questions are essential part of any programming interview, no matter whether you are going for Java interview or C#  interview. In face programming and design skill complement each other quite well, people who are good programmer are often a good designer as well as they know how to break a problem in to piece of code or software design but these skill just doesn’t come. You need to keep designing, programming both small scale and large scale systems and ke [..]

Best Practices while dealing with Password in Java

Published on 2012-05-31 08:05:00

While working in core Java application or enterprise web application there is always a need of working with passwords in order to authenticate user. Passwords are very sensitive information like Social Security Number(SSN) and if you are working with real human data like in online banking portal or online health portal its important to follow best practices to deal with passwords or Social security numbers. here I will list down some of the points I learned and take care while doing authenticati [..]

How to use ThreadLocal in Java - Benefits, Example Tutorial

Published on 2012-05-30 10:17:00

ThreadLocal in Java is another way to achieve thread-safety apart from writing immutable classes. If you have been writing multi-threaded or concurrent code in Java then you must be familiar with cost of synchronization or locking which can greatly affect Scalability of application, but there is no choice other than synchronize if you are sharing objects between multiple threads. ThreadLocal in Java is a different way to achieve thread-safety, it doesn't address synchronization requirement, [..]

10 points about .class file in Java

Published on 2012-05-26 00:00:00

.class file in Java is core of achieving platform independence which is key feature of Java. class files are compiled form of any Java program written in byte codes. Since Java program executes inside JVM, these instructions are read by JVM and than translated into machine code for underlying platform. effectively you can run class file on any platform if you have a corresponding JVM supported for that platform. Java compilers are responsible for generating .class file and they follow class file [..]

How to access private field and method using Reflection in Java

Published on 2012-05-25 08:08:00

Reflection in Java is very powerful feature and allows you to access private method and fields which is not possible by any other means in Java and because of this feature of reflection many code coverage tool, static analysis tool and Java IDE like Eclipse and Netbeans has been so helpful. In last article we have seen details about private keyword in Java and learned  why we should always make fields and method private in Java. There we have mentioned that private fields and methods are only a [..]

How to copy file in Java Program example tutorial

Published on 2012-05-25 00:03:00

How to copy file in Java from one directory to another is common requirement, given that there is no direct method in File API for copying files from one location to another. Painful way of copying file is reading from FileInputStream and writing same data to FileOutputStream to another directory. Though this process works its pretty raw to work with and best approach is for anyone to create library for common File operation like cut, copy, paste etc. Thankfully you don't need to reinvent wh [..]

Different types of JDBC drivers in Java - Quick overview

Published on 2012-05-24 06:48:00

How many types of JDBC drivers in Java is a classical JDBC interview question , though I have not see this question recently but it was very popular during 2006 - 2008 period and still asked mostly on Junior programmer level interviews. There are mainly 4 types of JDBC drivers in Java, those are referred as type 1 to type 4 jdbc drivers. I agree its easy to remember them by type rather than with there actual name, Which I have yet to get in memory except plain old JDBC-ODBC bridge driver. By the [..]

break continue and label in loop – Java program example

Published on 2012-05-23 08:56:00

break and continue in Java are two essential keyword beginners needs to familiar while using loops ( for loop, while loop and do while loop). break statement in java is used to break the loop and transfers control to the line immediate outside of loop while continue is used to escape current execution and transfers control back to start of the loop. Both break and continue allows programmer to create sophisticated algorithm and looping constructs. In this java tutorial we will see example of bre [..]

What is Bean scope in Spring MVC framework with Example

Published on 2012-05-22 07:36:00

Bean scope in Spring framework or Spring MVC are scope for a bean managed by Spring IOC container. As we know that Spring is a framework which is based on Dependency Injection and Inversion of Control and provides bean management facilities to Java application. In Spring managed environment bean (Java Classes) are created and wired by Spring framework. Spring allows you to define how those beans will be created and scope of bean is one of those details. This Spring tutorial is next on my earlier [..]

Counting Semaphore Example in Java 5 – Concurrency Tutorial

Published on 2012-05-21 09:27:00

Counting Semaphore in Java is a synchronizer which allows to impose a bound on resource is added in Java 5 along with other popular concurrent utilities like CountDownLatch, CyclicBarrier and Exchanger etc. Counting Semaphore in Java maintains specified number of pass or permits, In order to access a shared resource, Current Thread must acquire a permit. If permit is already exhausted by other thread than it can wait until a permit is available due to release of permit from different thread. Thi [..]

5 Difference between Application Server and Web Server in Java

Published on 2012-05-18 09:30:00

Application server and web server in Java both are used to host Java web application. Though both application server and web server are generic terms, difference between application server and web server is a famous J2EE interview question. On  Java J2EE perspective main difference between web server and application server is support of EJB. In order to run EJB or host enterprise Java application (.ear) file you need an application server like JBoss, WebLogic, WebSphere or Glassfish, while you [..]

Difference between java and javaw executable commands

Published on 2012-04-28 22:37:00

difference between java.exe and javaw.exe commands was the recent java question asked to one of my friend. while running java program on windows you might have noticed that they will appear in task manager as either java.exe or javaw.exe,  also in JAVA_HOME/bin we see these two java commands java.exe and javaw.exe, do you know difference between java.exe and javaw.exe ? surprisingly not many java programmer know answer of this java interview question, may be because java developers has not paid [..]

Java program to reverse a number - Example tutorial

Published on 2012-04-19 14:00:00

How to reverse a number in Java without using any API or write a simple Java program to reverse a number is common programming questions asked on fresher level software engineer interviews. Reversing a number is also popular homework questions on many Java programming courses on school, colleges and training institutes. I personally feel java program to reverse number is good programming exercise for some one who is just started learning programming in Java or any other programming language beca [..]

How to measure elapsed execution time in Java - StopWatch Example

Published on 2012-04-18 13:00:00

There are two ways to measure elapsed execution time in Java either by using System.currentTimeinMillis()or by using  System.nanoTime(). These two methods can be used to measure elapsed or execution time between two method calls or event in Java. Calculating elapsed time is one of the first thing Java programmer do to find out how many seconds or millisecond a method is taking to execute or how much time a particular code block is taking. Most of Java programmer are familiar with System.current [..]

Difference between List and Set in Java Collection

Published on 2012-04-17 03:09:00

What is difference between List and Set in Java is a very popular Java collection interview questions and an important fundamental concept to remember while using Collections class in Java. Both List and Set are two of most important Collection classes Java Program use along with various Map implementation. Basic feature of List and Set are abstracted in List and Set interface in Java and then various implementation of List and Set adds specific feature on top of that e.g. ArrayList in Java is a [..]

How to invoke method by name in java dynamically using reflection

Published on 2012-04-16 12:55:00

In Java you can invoke any method by its string name dynamically using reflection API. java.lang.reflect API provides powerful reflection mechanism which can load classes by its name even if classes are not available at compile time, Can get all methods including private and public from class and allow you to invoke any method dynamically using reflection. For those who are new in Java this sound pretty strange that at runtime you provide a method name using string and Java can run that method w [..]

Difference between java.util.Date and java.sql.Date in Java - JDBC Question

Published on 2012-04-15 12:17:00

Difference between java.util.Date and java.sql.Date in Java or why does Java has java.sql.Date if there is already a Date class in java util package is a common java interview question. There is always confusion among many Java developer familiar with both java.util.Date and java.sql.Date. Though many of them already using java.sql.Date to interface with DATE type of any relational database like mysql, oracle or any other database. In this Java tutorial we will see some differences between java. [..]

How to convert local time to GMT in Java Program Example tutorial code

Published on 2012-04-14 12:00:00

Converting local time into GMT or any other timezone in Java is easy as Java has support for time zones. JDK has a class called java.util.Timezone which represents timezone and Java also has classes like SimpleDateFormat which can use Time zone while parsing or formatting dates. By using java.uti.TimeZone and java.text.SimpleDateFormat we can write simple Java program to convert local time to GMT or any other time zone in Java. We have already seen example of How to get current date and time in [..]

Java Program to connect Oracle Database with Example - JDBC Tutorial Sample Code

Published on 2012-04-13 22:17:00

How to connect to Oracle database from Java Program using JDBC API is common need for many Java programmer, though there are lot of framework available which has simplified JDBC development e.g hibernate, Spring JdbcTempate and many more, but creating Java program to connect to oracle database from plain old Java is still most easy and quickest method for testing and debugging database connectivity. Database connection program is also a common Java programming exercise in many Java programming c [..]

Java PropertyUtils Example - getting and setting properties by name

Published on 2012-04-13 10:09:00

PropertyUtils class of Apache commons beanutils library is very useful and provides you ability to modify properties of Java object at runtime. PropertyUtils enables you to write highly configurable code where you can provide name of bean properties and there values from configuration rather than coded in Java program and Apache PropertyUtils can set those properties on Java object at runtime. One popular example of how powerful PropertyUtils can be is display tag which provides rich tabular dis [..]

Java Program to find factorial of number in Java - Example Tutorial

Published on 2012-04-13 09:04:00

How to find factorial of a number in Java on both recursive and iterative way is a common Java interview question mostly asked at fresher level. It’s not just popular on Java interview but also on other programming language like C or C++. Its also famous  In our last article we have seen how to check if a number is prime or not and in this Java programming tutorial we will see a simple Java program to find factorial of a number in Java by using recursion and iteration. Same program can also b [..]

Java Program to print Prime numbers in Java - Example Tutorial and Code

Published on 2012-04-13 07:14:00

How to print Prime numbers in Java or how to check if a number is prime or not is classical Java programming questions, mostly taught in Java programming courses. A number is called prime number if its not divisible by any number other than 1 or itself and you can use this logic to check whether a number is prime or not. This program is slightly difficult than printing even or odd number which are relatively easier Java exercises. This Simple Java program print prime number starting from 1 to 10 [..]

What is bounded and unbounded wildcards in Generics Java

Published on 2012-04-06 01:41:00

Bounded and unbounded wildcards in Generics are two types of wildcard available on Java. Any Type can be bounded either upper or lower of class hierarchy in Generics by using bounded wildcards. In short and represent bounded wildcards while represent an unbounded wildcard in generics . In our last article How Generics works in Java , we have seen some basic details about bounded and unbounded wildcards in generics and In this Java tutorial we will see bounded and unbounded generics wildcards [..]

10 points on interface in Java with Example - Tutorial

Published on 2012-04-05 20:31:00

Interface in java is core part of its programming language despite that many programmers thinks Java Interface as an advanced concept and refrain using interfaces from early in programming career. At very basic level  interface  in java is a keyword  but same time it is an object oriented term to define contracts and abstraction , This contract is followed by any implementation of Interface in Java. Since multiple inheritance is not allowed in Java,  interface is only way to implement multip [..]

How to find current directory in Java with Example

Published on 2012-04-01 04:56:00

Its easy to get current directory in Java by using built-in system property provided by Java environment. Current directory represent here the directory from where "java" command has launched. you can use "user.dir" system property to find current working directory in Java. This article is in continuation of my earlier post on Java e.g. How to load properties file in Java on XML format or How to parse XML files in Java using DOM parser and Why Java doesn’t support multiple inheritance . If you [..]

Private in Java: Why should you always keep fields and methods private?

Published on 2012-03-31 04:10:00

Making members private in Java is one of best coding practice. Private members (both fields and methods) are only accessible inside the class they are declared or inside inner classes. private keyword is one of four access modifier  provided by Java and its a most restrictive among all four e.g. public, default(package), protected and private. Though there is no access modifier called package, rather its a default access level provided by Java. In this Java tutorial we will see why should we al [..]

How to Compare two String in Java - String Comparison Example

Published on 2012-03-29 22:20:00

String comparison is a common programming task and Java provides several way to compare two String in Java. String is a special class in Java, String is immutable and It’s used a lot in every single Java program starting from simple test to enterprise Java application. In this Java String compare tutorial we will see different ways to compare two String in Java and find out how they compare String and when to use equals() or compareTo() for comparison etc. Here are four examples of comparing [..]

How to loop ArrayList in Java - Code Example

Published on 2012-03-28 21:45:00

Looping ArrayList in Java or Iteration over ArrayList is very similar to looping Map in Java. In order to loop ArrayList in Java we can use either foreach loop, simple for loop or Java Iterator from ArrayList. We have already touched iterating ArrayList in 10 Example of ArrayList in Java and we will see here in detail. We are going to see examples of all three approaches in this ArrayList tutorial and find out which one is clean and best method of looping arraylist in Java. Before start writing [..]

Difference between start and run method in Thread – Java Tutorial

Published on 2012-03-25 01:01:00

Why do one call start method of thread if start() calls run() in turn" or "What is difference by calling start() over run() method in java thread" are two widely popular beginner level multi-threading interview question. When a Java programmer start learning Thread, first thing he learns is to implement thread either overriding run() method of Thread class or implementing Runnable interface and than calling start() method on thread, but with some experience he finds that start() method calls run [..]

Why use PreparedStatement in Java JDBC – Example Tutorial

Published on 2012-03-24 05:36:00

PreparedStatement in Java is one of several ways to execute SQL queries using JDBC API. Java provides Statement,PreparedStatement and CallableStatement for executing queries. Out of these three, Statement is used for general purpose queries, PreparedStatement is used for executing parametric query and CallableStatement is used for executing Stored Procedures. PreparedStatement is also a popular topic in java interviews. Questions like Difference between Statement and PreparedStatement in Java an [..]

SimpleDateFormat in Java is not Thread-Safe Use Carefully

Published on 2012-03-23 21:48:00

SimpleDateFormat in Java  very common and used to format Date to String and parse String into Date in Java but it can cause very subtle and hard to debug issues if not used carefully because DateFormat and SimpleDateFormat both are not thread-safe and buggy. call to format() and parse() method mutate state of DateFormat class and should be synchronized externally in order to avoid any issue. here are few points which you should take care while using SimpleDateFormat in Java: Read more » Java, [..]

How to find file and directory size in Unix with Example - Linux tutorial

Published on 2012-03-23 10:39:00

How to find size of directory in unixFinding file size or directory size in Unix and Linux is not very difficult but if you came from windows background than it may sounds difficult to you because you need to remember unix commands for file and directory size. This is a common complain from windows user when they exposed to Unix operating system be it Linux or Solaris. but In my opinion having commands for doing things is more powerful because you can write powerful scripts for removing large fi [..]

Difference between transient and volatile keyword in Java

Published on 2012-03-23 00:17:00

Surprisingly "Difference between transient and volatile keyword in Java" has asked many times on various java interview. volatile and transient are two completely different keywords from different areas of Java programming language. transient keyword is used during serialization of Java object while volatile is related to visibility of variables modified by multiple thread during concurrent programming. Only similarity between volatile and transient is that they are less used or uncommon keyword [..]

How to fix java.io.FileNotFoundException: (Access is denied)

Published on 2012-03-22 23:46:00

Earlier my impression was that java.io.FileNotFoundException: (Access is denied) comes when you try to read a text or binary file for which you don't have permission from Java program but this can also come while you are using jar command. jar command internally use java.util.zip.ZipFile class to open any jar or war file which can throw java.io.FileNotFoundException: (Access is denied). I was trying to see contents of war file which was created using recent build when I stumble upon this err [..]

Spring Security Example Tutorial - How to limit number of User Session in Java J2EE

Published on 2012-03-22 23:10:00

Spring security can limit number of session a user can have. If you are developing web application specially secure web application in Java J2EE then you must have come up with requirement similar to online banking portals have e.g. only one session per user at a time or no concurrent session per user. You can also implement this functionality without using spring security but with Spring security its just piece of cake with coffee :). Spring Security provides lots of Out of Box functionality a [..]

What is Daemon thread in Java and Difference to Non daemon thread - Tutorial Example

Published on 2012-03-16 22:53:00

Daemon thread in Java are those thread which runs in background and mostly created by JVM for performing background task like Garbage collection and other house keeping tasks. Difference between Daemon and Non Daemon(User Threads)  is also an interesting multi-threading interview question, which asked mostly on fresher level java interviews. In one line main difference between daemon thread and user thread is that as soon as all user thread finish execuction java program or JVM terminates itsel [..]

How to get ServletContext in Servlet, JSP, Action class and Controller.

Published on 2012-03-16 21:46:00

How to get ServletContext in Servlet, jsp, spring controller or struts action class is common need of any Java web developer. As ServletContext is an application wide object and used to store variables in global scope, getting a reference of ServletContext is pretty important. Every web application can have only one ServletContext though they can have multiple ServletConfig object. In this article we will see : How to get Servlet Context inside Spring MVC Controller?How to find  Servlet Contex [..]

Why character array is better than String for Storing password in Java

Published on 2012-03-15 08:34:00

Why character array is better than String for storing password in Java was recent question asked to one of my friend in a java interview. he was interviewing for a Technical lead position and has over 6 years of experience.Both Character array and String can be used to store text data but choosing one over other is difficult question if you haven't faced the situation already. But as my friend said any question related to String must have a clue on special property of Strings like immutabili [..]

Mixing static and non static synchronized method - Java mistake 2

Published on 2012-03-13 09:22:00

Using static and non static synchronized method for protecting shared resource is another Java mistake we are going to discuss in this part of  our series “learning from mistakes in Java”. In last article we have seen why double and float should not be used for monetary calculation , In this tutorial we will find out why using static and non static synchronized method together for protecting same shared resource is not advisable. I have seen some times Java  programmer mix static synchron [..]

What is GET and POST method in HTTP and HTTPS Protocol

Published on 2012-03-11 07:34:00

GET and POST method in HTTP and HTTPS ProtocolGET and POST method in HTTP and HTTPS are two most popular methods used to transfer data from client to server using  HTTP(Hyper Text Transfer Protocol)  protocol. Both GET and POST can be used to send request and receive response but there are significant difference between them. Difference between GET and POST in HTTP or HTTPS is also a popular interview question in JSP and any web programming interview. Since HTML is independent of any web serve [..]

What is Static and Dynamic binding in Java with Example

Published on 2012-03-10 22:24:00

Static and dynamic binding  in Java are two important concept which Java programmer should be aware of. this is directly related to execution of code. If you have more than one method of same name (method overriding) or two variable of same name in same class hierarchy it gets tricky to find out which one is used during runtime as a result of there reference in code. This problem is resolved using static and dynamic binding in Java. For those who are not familiar with binding operation, its pro [..]

10 points on finalize method in Java – Tutorial Example

Published on 2012-03-10 04:12:00

finalize method in java is a special method much like main method in java. finalize() is called before Garbage collector reclaim the Object, its last chance for any object to perform cleanup activity i.e. releasing any system resources held, closing connection if open etc. Main issue with finalize method in java is its not guaranteed by JLS that it will be called by Garbage collector or exactly when it will be called, for example an object may wait indefinitely after becoming eligible for garbag [..]

What is Encapsulation in Java and OOPS with Example

Published on 2012-03-10 00:06:00

Encapsulation in Java or object oriented programming language is a concept which enforce protecting variables, functions from outside of class, in order to better manage that piece of code and having least impact or no impact on other parts of program duec to change in protected code. Encapsulation in Java is visible at different places and Java language itself provide many construct to encapsulate members. You can completely encapsulate a member be it a variable or method in Java by using priva [..]

10 example of chmod command in UNIX Linux

Published on 2012-03-09 22:16:00

chmod command in UNIX or Linux is used to change file or directory permissions. This is one of many UNIX basic commands which a UNIX or Linux user must be familiar with. In this UNIX command tutorial we will see how to change file permissions using chmod command, what are file permissions in UNIX, how to change permissions of directory and sub-directory using UNIX chmod command and finally how to create executable files in UNIX using chmod command. Before going directly into examples of chmod co [..]

Top 10 EJB Interview Question and Answer asked in Java J2EE Interviews

Published on 2012-03-08 07:35:00

10 EJB Interview Questions and Answer from my collection of interview questions. I have been sharing interview questions on various topics like Singleton interview question, serialization interview question and most recently Spring interview questions. No doubt these questions are very important from performing better in J2EE and EJB interviews but also they open new path for learning as you may find some concept new even while revising your knowledge in EJB. EJB interviews has always been tough [..]

java.lang.UnsatisfiedLinkError: no dll in java.library.path Exception Java

Published on 2012-03-07 08:31:00

Java - Exception in thread "main" java.lang.UnsatisfiedLinkError: no dll in java.library.path"Exception in thread "main" java.lang.UnsatisfiedLinkError: no dll in java.library.path" is a frusttrating exception you will get if your application is using native library from java.lang.System.loadLibarray() method. I was writing  some Tibco Rendezvous Messaging code which uses some windows specific dll and I got "java.lang.UnsatisfiedLinkError: no *.dll in java.library.path". here we will see real c [..]

How to read Properties File in Java – XML and Text Example Tutorial

Published on 2012-03-06 07:16:00

Reading and writing properties file in Java is little different than reading or writing text file in Java or  reading xml files in Java using xml parsers like DOM because Java provides special provision to properties file. For those who are not familiar with Properties file in java, It is used to represent configuration values like JDBC connectivity parameter or user preferences settings and has been a primary source of injecting configuration on Java application.  Properties file in Java i [..]

How to add or list certificates from keystore or trustStore in Java - Keytool Example

Published on 2012-03-05 06:59:00

How to add certificates on keystore in Java is primary questions when you start working on SSL connection and simple answer is keytool utility in Java is used to add or list Certificates into keystore. SSL is industry standard for secure communication between two parties e.g. client and server. SSL offers two benefits, it encrypts data transferred between client and server to make it hard for someone to access and understand in between and SSL also verify identity of two parties in communication [..]

10 Object Oriented Design principles Java programmer should know

Published on 2012-03-03 23:00:00

Object Oriented Design Principles are core of OOPS programming but I have seen most of Java programmer chasing design patterns like Singleton pattern , Decorator pattern or Observer pattern but not putting enough attention on Object oriented analysis and design or following these design principles. I have regularly seen Java programmers and developers of various experience level who either doesn't heard about these OOPS and SOLID design principle or simply doesn't know what benefits a pa [..]

java.lang.NoSuchMethodError: main Exception in thread "main"

Published on 2012-03-02 21:41:00

How to solve java.lang.NoSuchMethodError: main Exception in thread "main"java.lang.NoSucMethodError comes when Java code tries to call a method which is not existed on a class, this could be either static or non static method. most common manifestation of java.lang.NoSuchMethodError is running a class which doesn't have main method in Java. In this article we will see what is "java.lang.NoSuchMethodError: main Exception in thread "main"" , Why does java.lang.NoSuchMethodError comes and how t [..]

How to create and execute JAR file in Java – Command line Eclipse Netbeans

Published on 2012-03-02 21:08:00

Creating JAR file in java from command prompt is always been little tricky for many of us even if IDE like Netbeans and Eclipse provide support to export java program as JAR file simply because we don’t create jar often and not familiar with manifest file or jar command as whole. JAR file in Java is a kind of zip file which holds all contents of a Java application including Class files, resources such as images, sound files and optional Manifest file. JAR stands for Java Archive and provides a [..]

How to format Decimal Number in Java - DecimalFormat Example

Published on 2012-03-01 08:58:00

We often need to format decimal numbers in Java like formatting numbers upto 2 decimal places or 3 decimal places or we want to introduce leading zeros in front of numbers. Thankfully Java programming language provides many different ways to format numbers in Java like either using Math.round() or setScale() from BigDecimal but caveat is that they also do rounding of numbers i.e. 1.6 will be rounded on 2.0 if we use Match.round(). If we are just interested in formatting decimal numbers upto n de [..]

Java Mistake 1 - Using float and double for monetary or financial calculation

Published on 2012-02-29 07:41:00

Java is considered very safe programming language compared to C and C++ as it doesn't have free() and malloc() to directly do memory allocation and deallocation, You don't need to worry of array overrun in Java as they are bounded and there is pointer arithmetic in Java. Still there are some sharp edges in Java programming language which you need to be aware of while writing enterprise application. Many of us make subtle mistake in Java which looks correct in first place but turn out to [..]

How to convert Char to String in Java with Example

Published on 2012-02-26 08:25:00

There are multiple ways to convert char to String in Java. In fact String is made of Character array in Java, which can be retrieved by calling String.toCharArray() method. Char is 16 bit or 2 byte unsigned data type in java mainly used to store characters. You can convert a single character into String for any purpose in Java by more than one ways. I thought about this article while writing how to convert Integer to String in Java but t it took little longer to get this post completed. In this [..]

How to check or detect duplicate elements in Array in Java

Published on 2012-02-25 21:19:00

Detecting duplicate elements in Java array is another programming interview question I like. There could be lot of way you can check if your array contains duplicate elements or not and sometime you discover a unique way of checking duplicates by asking this question on Java interview. Beauty of this question is that it has endless number of follow-up question so if interviewee get through this question you can ask to him about time complexity and space or to improve his algorithm to make i [..]

How to solve java.util.NoSuchElementException in Java

Published on 2012-02-25 01:34:00

How to fix java.util.NoSuchElementException in Javajava.util.NoSuchElementException is a RuntimeException which can be thrown by different classes in Java like Iterator, Enumerator, Scanner or StringTokenizer. All of those classes has method to fetch next element or next tokens if underlying data-structure doesn't have any element Java throws "java.util.NoSuchElementException". Most common example of this iterating over hashmap without checking if there is any element or not and that's w [..]

How to set JAVA_HOME environment in Linux, Unix and Windows

Published on 2012-02-21 23:34:00

JAVA_HOME is a system environment variable which represent JDK installation directory. When you install JDK in your machine (windows, Linux or unix) it creates a home directory and puts all its binary (bin), library(lib) and other tools. In order to compile java program "javac" tool should be in your PATH and in order to get that in PATHwe use JAVA_HOME environment variable. Many tools like ANT and web servers like tomcat use JAVA_HOME to find java binaries. In this article we will see how to se [..]

What is Race Condition in multithreading – 2 Examples in Java

Published on 2012-02-21 23:08:00

Race condition in Java is a type of concurrency bug or issue which is introduced in your program because  parallel execution of your program by multiple threads at same time, Since Java is a multi-threaded programming language hence risk of Race condition is higher in Java which demands clear understanding of what causes a race condition and how to avoid that. Anyway Race conditions are just one of hazards or risk presented by  use of multi-threading in Java just like deadlock in Java. Race co [..]

JSTL set tag or <c:set> examples in JSP – Java J2EE Tutorial

Published on 2012-02-21 19:30:00

JSTL set tag or also called as JSTL Core tag library is a good replacement of jsp action which lacks lot of functionality and only allow you to set bean property. you can not set Map's key value or create a scoped variable by using . jstl tag allows you to do all the stuff related to setting or creating variables or attributes. by using JSTL tag you can : Read more » Java, Unix, Tibco RV and FIX Protocol Tutorial

Difference between throw and throws in Exception handling - Java Example

Published on 2012-02-21 08:08:00

Difference between throw and throws keyword on Exception handling in Java is a popular core java interview question. Exception handling being an important part of Java programming language, complete knowledge of all keywords related to exception handling e.g. try, catch, finally, throw and throws is important. Main difference between throw and throws is in there usage and functionality. where throws is used in method signature to declare Exception possibly thrown by any method, throw is actually [..]

Difference between LinkedList vs ArrayList in Java

Published on 2012-02-18 20:44:00

LinkedList and ArrayList both implement List Interface but how they work internally is where the differences lies. Main difference between ArrayList and LinkedList is that ArrayList is implemented using re sizable array while LinkedList is implemented using doubly LinkedList. ArrayList is more popular among Java programmer than LinkedList as there are few scenarios on which LinkedList is a suitable collection than ArrayList. In this article we will see some differences between LinkedList and Arr [..]

How to encode decode String in Java base64 Encoding

Published on 2012-02-17 08:38:00

Encoding and Decoding of String in Java using base64 is extremely easy if you are using apache commons code opensource library. it provides convenient static utility method Base64.encodeBase64(byte[]) and Base64.decodeBase64(byte []) for converting binary data into base64 encoded binary Stream and than decoding back from encoded data in base64 encoding mechanism. Many times we need to encode sensitive data be it binary String  format transferring over socket or transferring or storing data in x [..]

Producer Consumer Design Pattern with Blocking Queue Example in Java

Published on 2012-02-16 07:44:00

Producer Consumer Design pattern is a classic concurrency or threading pattern which reduces coupling betweenProducer and Consumer by separating Identification of work with Execution of Work. In producer consumer design pattern a shared queue is used to control the flow and this separation allows you to code producer and consumer separately. It also addresses the issue of different timing require to produce item or consuming item. by using producer consumer pattern both Producer and Consumer Thr [..]

Why non-static variable cannot be referenced from a static context?

Published on 2012-02-15 06:56:00

"non-static variable cannot be referenced from a static context" is biggest nemesis of some one who has just started programming and that too in Java. Since main method in java is most popular method among all beginners andthey try to put program code there they face "non-static variable cannot be referenced from a static context" compiler error when they  try to access a non static member variable inside main in Java which is static. if you want to knowwhy main is declared static in Java see t [..]

fail-safe vs fail-fast Iterator in Java

Published on 2012-02-11 01:01:00

Difference between fail-safe and fail-fast Iterator is becoming favorite core java interview questions day by day, reasonit touches concurrency a bit and interviewee can go deep on it to ask how fail-safe or fail-fast behavior is implemented.In this article article we will see what is fail-safe and fail fast iterators in java and differences between fail-fast and fail-safe iterators . Concept of fail-safe iterator are relatively new in Java and first introduced with Concurrent Collections in Jav [..]

How to fix java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory

Published on 2012-02-08 08:39:00

java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory  or "Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory" exception comes when you don't apache commons-logging-1.1.1.jar in your Classpath. I have faced this exception many times while using open source framework like Struts, Spring and Displaytag which uses commons-logging framework for logging. commons-logging is not an actual java logging framework but provides a wrapper [..]

What is blocking methods in Java and how do deal with it?

Published on 2012-02-06 08:20:00

Blocking methods in Java are those method which block the executing thread until there operation finished. Famous example of blocking method is InputStream read() method which blocks until all data from InputStream has been readcompletely. Correct understanding of blocking methods are required if you are serious towards Java programming speciallyin early days because if not used carefully blocking method can freeze GUIs, hung your program and become non responsive for longer duration of time. In [..]

Why wait, notify and notifyAll is defined in Object Class and not on Thread class in Java

Published on 2012-02-04 23:59:00

Why wait, notify and notifyAll is declared in Object Class instead of Thread is famous core java interview question which is asked during all levels of Java interview ranging from 2 years, 4years to quite senior level position on java development. Beauty of this question is that it reflect what does interviewee knows about wait notify mechanism, how does it sees whole wait and notify feature and whether his understanding is not shallow on this topic. Like Why Multiple inheritance is not supporte [..]

3 Example to Compare two Dates in Java

Published on 2012-02-01 19:48:00

comparing dates in Java is common need for Java programmer, now and then we need to compare two dates to check whether two dates are equals, less than or greater than each other, some time we also needs to check if one dates comes in between two dates. Java provides multiple ways to compare two Dates in Java which is capable of performing Date comparison and letting you know whether two dates are same, one date come before or after another date in Java. In last couple of article we have seen how [..]

Difference between instance class and local variables in Java

Published on 2012-02-01 09:37:00

There are lot of differences between instance variable, class variable and local variable in Java and knowing them will help you to write correct and bug free Java programs. Java is full featured programming language and provides different kind of variables like static variable also called Class variable since it belongs to whole Class, non static also called instance variable and local variables which varies in scope and value. Thank god Java doesn't have any register variable or auto scope [..]

How to reverse String in Java using Iteration and Recursion

Published on 2012-01-30 03:46:00

How to reverse string in java is popular core java interview question and asked on all levels from junior to senior java programming job. since Java has rich API most java programmer answer this question by using StringBuffer reverse() method which easily reverses an String in Java and its right way if you are programming in Java but most interview doesn't stop there and they ask interviewee to reverse String in Java without using StringBuffer or they will ask you to write an iterative rever [..]

How to resolve java.lang.UnsupportedClassVersionError with example

Published on 2011-07-01 23:13:00

How to resolve UnsupportedClassVersionError in Javajava.lang.UnsupportedClassVersionError is a quite common error after NoClassDefFoundError or ClassNotFoundException they all seems to related to class files but they all are different and there

List of special bash parameter used in Unix or Linux script

Published on 2011-06-25 23:28:00

Meaning of bash parameter used in Unix scriptMany of us use bash script for doing housekeeping and other stuff but occasionally and not much aware of special bash parameters. When I was new to bash shell and Linux and looking on some already written

3 example of converting array to arraylist and arraylist to array in java

Published on 2011-06-23 08:23:00

How to change from array to arraylist and arraylist to array in javaHave you encounter any situation where you quickly wanted to covert your array to arraylist or arraylist to array? I have faced many such situations which motivate me to write these

10 example of using Vim or VI editor in UNIX

Published on 2011-06-20 22:49:00

Vim or VI editor tutorial in UNIX VI Editor is like notepad in UNIX but it’s extremely powerful and have sophisticated feature to work as complete IDE. No matter which version of UNIX you are working or which flavor you are using you always find ei

3 ways to resolve NoClassDefFoundError in Java

Published on 2011-06-19 06:22:00

What is Exception in thread "main" java.lang.NoClassDefFoundError?I know how frustrating is to see Exception in thread "main" java.lang.NoClassDefFoundError Which is a manifestation of NoClassDefFoundError in Java , I have seen it couple

How to use Comparator and Comparable in Java? With example

Published on 2011-06-18 01:43:00

Comparator and Comparable in Java ExamplesWhat is Difference between Comparator and Comparable in Java question was asked in a Test paper for one of big Investment bank first round of interview. It was not that straight forward but it was related to

10 examples of grep command in UNIX and Linux

Published on 2011-06-12 02:04:00

10 examples of grep command in UNIX and Linux"grep" one of the most frequently used UNIX command stands for "Global Regular Expression Print". This grep command tutorial is not about theory of UNIX grep but to practical use of grep in UNIX and here I

Top 30 Programming questions asked in Interview

Published on 2011-06-10 04:20:00

Top 30 Programming interview questionsProgramming questions are integral part of any java or C++ programmer or software analyst interview. No matter on which language you have expertise it’s expected that you are familiar with fundamental of progra

Tibco tutorial : Reliability Parameter

Published on 2011-06-08 10:42:00

This is one of the important statup parameter we provide to rvd and incorrect setting up of this parameter can screw up things in big way. What is Reliability parameter of tibco? Message expiration depends on reliability parameter, the less the rel

How Volatile in Java works ? Example of volatile keyword in Java

Published on 2011-06-03 23:03:00

How Volatile keyword works in JavaVolatile keyword in Java is used as an indicator to Thread that do not cache value of this variable and always read it from main memory. So if you want to share any variable in which operations read and write is atom

An Example of using ArrayList in Java 1.5 with generics

Published on 2011-05-26 06:07:00

How to use ArrayList in java5 with GenericsArrayList in Java is most frequently used collection class after HashMap in Java. Java ArrayList represents an automatic resizable array and used in place of array. Since we can not modify size of an array a

Why wait (), notify () and notifyAll () must be called from synchronized block or method in Java

Published on 2011-05-21 01:02:00

Why wait (), notify () and notifyAll () must be called from synchronized block or method in JavaMost of Java developer knows that wait() ,notify() and notifyAll() method of object class must have to be called inside synchronized method or synchronize

Top 20 UNIX command Interview Questions asked in Investment Banks

Published on 2011-05-14 05:46:00

Top 20 UNIX command Interview Questions AnswersUNIX or Linux operating system has become default Server operating system and for whichever programming job you give interview you find some UNIX command interview questions there. These UNIX command int

10 points about Java Heap Space or Java Heap Memory

Published on 2011-05-06 21:07:00

10 Points about Heap in JavaWhen I started java programming I didn't know what is java heap or what is heap space in Java, I was even not aware of where does object in Java gets created, it’s when I started doing professional programming I came acr

Tibco Tutorials for beginners

Published on 2011-05-05 07:54:00

This Tibco Tutorial is collection of all my previous Tibco rendezvous and Tibco EMS tutorials. I have written this compilation post to provide all tibco tutorials at one place for easy navigation and access. Anyone who is started working on Tibco on

Top 10 tips on logging in Java

Published on 2011-05-02 03:30:00

Java logging or logging in java is as much an art as science. knowing write tools and API for java logging is definitely science part but choosing format of java logs , format of messages, what to log in java , which logging level to use for which ki

How Synchronization works in Java ?

Published on 2011-04-27 04:32:00

In this Java synchronization tutorial we will see what is meaning of Synchronization in Java, Why do we need Synchronization in java, what is java synchronized keyword, example of using java synchronized method and blocks and important points about s

Difference between ConcurrentHashMap and Collections.synchronizedMap and Hashtable in Java

Published on 2011-04-24 10:38:00

Collections classes are heart of java API though I feel using them judiciously is an art. Its my personal experience where I have improved performance by using ArrayList where legacy codes are unnecessarily used Vector etc. JDK 1.5 introduces some

Symbolic link or symlink in Unix Linux

Published on 2011-04-22 00:11:00

Symbolic links or symlinks are the heart of UNIX commands in my opinion. Symlinks gives you so much power and flexibility that you can maintain things quite easily. Whenever I do scripting or write any UNIX script I always write for symlinks rather t

FIX Protocol Tutorial for beginners

Published on 2011-04-21 07:53:00

I have been writing FIX Protocol Tutorial from last few months and today I thought about doing a revision on all those FIX Protocol Tutorial. It’s very easy to read and forget about anything you have learn so periodic revision is very important and

Top 10 Java Serialization Interview questions

Published on 2011-04-16 04:05:00

Java Serialization is one of important concept but it’s been rarely used as persistence solution and developer mostly overlooked java serialization API. As per my experience Java Serialization is quite an important topic in any java interview

UNIX commands tutorial and tips for beginners.

Published on 2011-04-15 09:22:00

UNIX commands tutorial and tips for beginners.Hi, this is a kind of revision post where I would like share some of my earlier posted UNIX commands tutorial. Purpose of this post is to put together all UNIX commands tutorial in one place for easy acce

How Garbage Collection works in Java

Published on 2011-04-11 23:04:00

I have read many articles on Garbage Collection in Java, some of them are too complex to understand and some of them don’t contain enough information required to understand garbage collection in Java. Then I decided to write my own experience as an

Replaying messages in FIX protocol

Published on 2011-04-09 00:41:00

Replaying messages in FIX protocol In FIX Protocol two FIX engines communicate with each other using FIX messages and every FIX messages is assign with unique sequence number denoted by tag 34. Apparently every FIX engine has two sequence numbers Inc

Top 20 Core Java Interview questions asked in Invesment Bank

Published on 2011-04-07 10:09:00

Top 20 Core Java Interview questions in Finance domain This is a new series of sharing core Java interview question on Finance domain and mostly on Big Investment bank. Anybody who is preparing for any Java developer Interview on any Investment bank

Understanding DATALOSS Advisory in Tibco Rendezvous or Tibco RV

Published on 2011-04-01 23:21:00

Understanding DATALOSS Advisory in Tibco Rendezvous While working with TIBCO rendezvous you guys must have been faced problem of DATALOSS and might be aware of its severe consequences and in worst case how it can cause TIBCO Storm (A situation where

10 tips on working fast in UNIX

Published on 2011-03-29 09:51:00

10 tips for working fast in UNIX Have you ever amazed to see someone working very fast in UNIX, firing commands and doing things in mille seconds? Yes I have seen and I have always inspired to learn from those gems of guys. This article or tutorial o

10 examples of using find command in UNIX

Published on 2011-03-18 22:45:00

10 usage of find command in UNIX find is very versatile command in UNIX and I used it a lot in my day to day work. I believe having knowledge of find command in UNIX and understanding of its different usage will increase your productivity a lot in UN

Design Patterns in the JDK - Java Code Geeks

Published on 2011-03-06 03:25:00

Design Patterns in the JDK - Java Code Geeks

Googlers at Tech@State: Open Source Technology Conference - Google Open Source Blog

Published on 2011-03-06 03:07:00

Googlers at Tech@State: Open Source Technology Conference - Google Open Source Blog

Top 20 FIX Protocol Interview Questions

Published on 2011-03-05 21:22:00

Top 20 FIX Protocol Interview Questions its' been a while since I shared FIX protocol interview questions. So here is the new set of top 20 FIX protocol interview questions. These are the question which is mostly asked in while interviewing any devel

10 Interview questions on Singleton Pattern in Java

Published on 2011-03-03 06:28:00

10 Interview questions on Singleton Pattern in Java Singleton pattern is one of the most common patterns available and it’s also used heavily in Java. This is also one of my favorite interview question and has lots of interesting follow-up to digg

How to setup remote debugging in eclipse

Published on 2011-02-25 22:24:00

How to setup remote debugging in eclipse Remote debugging is not a new concept and many of you are aware of this just for who don’t know what is remote debugging? It’s a way of debugging any process could be Java or C++ running on some other loca

How to write equals method in JAVA

Published on 2011-02-23 21:43:00

How to write equals method in JAVA When I started JAVA i heard that JAVA is truly object oriented language and everything in JAVA is object, later I found that though its not completely true but yes most of things are in Java is represented via OOPS

How to execute native shell commands from JAVA

Published on 2011-02-22 08:56:00

How to execute native shell commands from JAVA Though it’s not recommended but some time it’s become necessary to execute native operating system or shell command from JAVA, especially if you are doing some kind of reporting or monitoring stuff a

FIX Protocol tutorials: Difference between Session Level Reject and Business message Reject

Published on 2011-02-18 21:14:00

FIX Protocol tutorials: Difference between Session Level Reject and Business message Reject In FIX protocol there are multiple ways of rejecting message some of them are using an Execution Report (MsgType=8) and ExecType=8 to reject a FIX message if

Repeating groups in FIX Protocol

Published on 2011-02-17 06:53:00

FIX Protocol repeating group In this FIX protocol tutorial I am going to share my experience about FIX repeating block or group. This is fundamental concept of FIX protocol and used to carry repeating data. Correct understanding of various available

Blogger Buzz: Subscribe to Comments - by email!

Published on 2011-02-15 08:29:00

Blogger Buzz: Subscribe to Comments - by email!

TIBCO Ledger file in Certified messaging : TIBCO Tutorial

Published on 2011-02-14 06:34:00

TIBCO Ledger files in certified messaging This is in continuation to my previous article on TIBCO Certified messaging, in this TIBCO tutorial we will discuss about what is TIBCO ledger? What is process based ledger and what is file based ledger? &nbs

How to implement Thread in JAVA

Published on 2011-02-12 07:32:00

How to implement Thread in JAVA In my opinion Thread is the most wonderful feature of JAVA and I remember when I started learning JAVA in one of programming class in India how important Thread was portrait and how much emphasis given on clear underst

FIX Protocol Session or Admin messages tutorial

Published on 2011-02-05 23:26:00

FIX Protocol Session or Admin messages tutorial I have been working in FIX protocol for almost 5 years when I started working on FIX protocol I looked upon internet for some good tutorial which could supplement or complement lengthy FIX protocol spec

Introduction to Tibco Hawk as Tibco Tutorial

Published on 2011-02-04 22:46:00

Tibco Hawk This is another short TIBCO tutorial from my TIBCO tutorial series. in this i am gonna discuss what is TIBCO hawk , Where do we use TIBCO hawk , What are components of TIBCO hawk , what benefit TIBCO hawk offers and how Tibco hawk wo

How HashMap works in Java

Published on 2011-02-02 03:57:00

How HashMap works in Java How HashMap works in Java or sometime how get method work in HashMap is common interview questions now days. Almost everybody who worked in Java knows what hashMap is, where to use hashMap or difference between hashtable and

test

Published on 2011-01-29 05:03:00

testing this to submit my blog feed automatically to digg.

How Classpath work in Java ?

Published on 2011-01-28 21:35:00

CLASSPATH in JAVACLASSPATH is one of the most important concepts in java but I must say oftenly overlooked. This should be the first thing you should learn while writing java programs because without understand classpath you can't understand how java

Difference between FIX 4.2 vs FIX 4.4 in FIX connectivity

Published on 2011-01-25 07:55:00

FIX 4.2 vs FIX 4.4 FIX protocol has evolved over time , its now more than a decade its started by Fidelity and Solomon Brothers. FIX connectivity is the most popular connectivity solution exists for trading whether its equities, futures, options or f

Things to note down while writing your own FIX Engine on FIX protocol

Published on 2011-01-24 08:05:00

This is in continuation of my FIX protocol tutorial series , i am just sharing some of thoughts which are important to remember while writing FIX engine for FIX protocol , though there are couple of professional third party FIX engines are available

Tibco RV Interview Question as part Tibco RV Tutorial series

Published on 2011-01-21 07:59:00

Hi Guys , in this part of my tibco rv tutorial series I am sharing some Tibco RV interview questions most oftenly asked in any tibco messagging interview. these are based on fundamental tibco concepts and also offers some new way of learning tibco rv

Tibco tutorial : RVD (Rendezeous daemon) vs RVRD (Rendezeous Routing Daemon)

Published on 2011-01-14 22:39:00

RVRD (Randezeous Routing Daemon) are simply process owned by middleware/network teams which listens multicast traffic locally and transmit it to another RVRD counter part (another host) using TCP. this remote host than re multicast this traffic to th

Tibco tutorial : Http Interface of Tibco RV

Published on 2011-01-14 22:38:00

This is another post of my tibco tutorial series , if you want to read more about tibco rv or tibco ems please read there. in this post I am sharing you great tool to solve tibco rv related problems and a great interface to anaylze your Tibco RVD act

Basics of FIX protcol and FIX Engine

Published on 2011-01-13 08:57:00

FIX protocol is Industry standard protocol for electronic trading , with evolution with computer technology Trading also getting Electronic and now most of the exchanges in the world are fully electronic and concept of trading floor is taken over by

FIX protocol tutorial : Fix Session is not connecting how to diagnose it ?

Published on 2011-01-11 09:22:00

In this blog post of FIX protocol tutorial series I would like to share my experience with connectivity issues around Fix Engines. to exchange message or say to trade electronically clients connect to broker using FIX protocol and for that they use F

Tibco tutorial : Tibrv Errors and Exceptions

Published on 2011-01-08 22:26:00

While working with tibco rv during many years I found that tibco errors are mysteriously difficult to diagnose for a newcomer and minor difference between syntax and semantics along with network specifics lead some strange error. here I am putting mo

Tibco tutorial : Difference between Tibco EMS and Tibco RV

Published on 2011-01-01 20:47:00

Both of them are product from Tibco and used extensively across global investment banks for front end to back end communication or server to server communication. though they have difference in the manner they have designed and the specification they

Happy New Year 2011

Published on 2010-12-31 01:39:00

Wishing you all very happy new year Welcome 2011 . May this year brings happiness , accomplishment and cheers to all.

Fix Protocol Interview Questions

Published on 2010-12-21 06:40:00

Some more Fix protocol interview question , I will put answer along when I'll get some time for now just questions :) Now I have updated it with answer , Please let me know if you have any doubt , or you have other questions , you can also co

Common issue on Fix Connections

Published on 2010-12-17 21:46:00

Hi guys , in this post I would like share my experience with Fix Connections which is essential to setup connectivity for trading purposes. Fix Connections used in both Client Connectivity and Exchange connectivity space ( in case exchange supports F

© 2006-2013 OnToplist.com, All Rights Reserved