The real difference between Process and Thread in Java



$ mount -t vboxsf mountfolder /home/devInHost/mountfolder


10 points about instanceof operator in Java with example

The instanceof operator in Java is used to check if an object belongs to a particular type or not at runtime. It's also a built-in keyword in Java programming language and mostly used to avoid ClassCastException in Java. It is used as safety-check before casting any object into a certain type. This operator has a form of object instanceof Type and returns true if the object satisfies IS-A relationship with the Type i.e. object is an instance of class Type or object is the instance of a class which extends Type or object is an instance of a class which implements interface Type. Once an object passed the instanceof check, it's safe to type-cast into that type, without worrying of java.lang.ClassCastException.

20 Java and Programming Quotes to Motivate Yourself

I always have a strong interest in knowing great peoples of my field i.e. programming. Knowing about them, following them and reading them not only gives you immense knowledge but the motivation you need to excel in what you are doing. It's motivation, not the knowledge that will propel your career. Knowledge is useless without motivation because knowing is not enough, you need to apply that knowledge, and without motivation, you just can't do that. There are times when the programmer's also felt tired and bored. These are the times when you spent hours constantly looking at the computer screen, clicking here and there, surfing the net without doing anything. That's the total waste of time and it's the result of poor motivation. If you are motivated then you will constantly work towards improving your code, writing more unit tests, creating better documentation and spending some time retrospecting, how could you have done better.

When to use intern() method of String in Java?

String.intern() method can be used to to deal with String duplication problem in Java. By carefully using the intern() method you can save a lot of memories consumed by duplicate String instances. A string is duplicate if it contains the same content as another string but occupied different memory location e.g. str1 != str2 but str1.equals(str2) is true. Since String object consumes a large amount of heap memory in average Java application, it makes sense to use intern() method to reduce duplication and take advantage of String pool feature provided by Java. You can use intern() method to intern a String object and store them into String pool for further reuse.

For example, when you create a String literal e.g. "abc", it's automatically stored in String pool, but when you create a new String object e.g. new String("abc"), even though it's same String, a new object at a different memory location is created. This is a duplicate String.

By calling  the intern() method on this object, you can instruct JVM to put this String in the pool and whenever someone else creates "abc", this object will be returned instead of creating a new object. This way, you can save a lot of memory in Java, depending upon how many Strings are duplicated in your program.

You can also read Java Performance by Charlie hunt and Java Performance, The Definitive Guide By Scott Oaks to learn more about troubleshooting Java Performance issue and optimizing the performance of Java applications.

How to split a comma separated String in Java? Regular Expression Example

You can use String.split() function or StringTokenizer class to split a comma separated String in Java. Since splitting a String is a very common functionality, Java designers have provided a couple of split() method on java.lang.String class itself. These split() function takes a regular expression and split the String accordingly. In order to parse a comma delimited String, you can just provide a "," as a delimiter and it will return an array of String containing individual values. The split() function internally uses Java's regular expression API (java.util.regex) to do its job. If you are not very familiar with the regular expression than you can also use StringTokenizer class, which can also split a comma delimited String but StringTokenizer is an old class and not recommended and you should try to use the split() function from java.lang.String class, as any performance improvement will likely to happen on this method than the StringTokenizer class. Let's see a couple of examples to split a comma separated String in Java. You can also see Java Regular Expressions, taming the java.util.regex engine to learn the full power of Java regular expression.

5 Good Books for Java JEE Programming Interviews

If you are preparing for Java interviews then apart from blogs and articles, you should also take help of books specially written for Java interviews. Though nothing can substitute true job experience but the interview is little bit different beast. Even if you have a good experience, if you are not going for exact same profile job then you can expect hell lot of questions from vast topics of Java domain, which you might not have heard before. Java developers usually appear for two kinds of interviews, first for core Java development role where the focus is mostly on core Java concepts like multi-threading, concurrency, design patterns, OOP, error handling, collections, JVM internals, GC and Java performance tuning. Second kind of Java interviews for Java EE or Java web development role where the focus is mostly on Java EE related technologies e.g.

Top 30 Microsoft Interview Questions for Software Development Engineers (SDE)

In this article, I am going to some frequently asked Microsoft Interview Questions for their Software Development Engineer role. I am mostly sharing technical questions which are based upon Data structure and Algorithms, and Software design. They don't put any restriction on any programming language, which means you are free to solve these problems using C, C++, Java or Python. If you are preparing for Microsoft Interview then these questions can give you some idea about the level of knowledge you need to clear the interview. Regarding how to prepare? You can take help from standard data structure algorithm books or you can use cracking the code interview book, which contains frequently asked questions from Google, Amazon, Apple, Facebook and, of course, Microsoft. For more comprehensive preparation see the recommended books at the bottom of this article.

Top 20 Core Java Interview Questions and Answers from Investment Banks

Core Java Interview Question Answer

