This is a basic tutorial explaining about the APIs define under the collection package in Java. We encounter numerous questions from our readers to clarify the differences on these interfaces, we have come up with an tutorial to explain the key differences on these APIs. ArrayList, Vector and LinkedList, these confuse many beginners and even …
Java
ClassLoader in Java
In this article we will understand the basics of Classloader in Java. Let us first understand what is the meaning of classloader. What is the ClassLoader ? As its name implies, ClassLoader is a class that loads other classes. More scientific: The Classloader loads the bytecodes in its class to memory, so it can be …
Example for a class implementing comparable interface in Java
When you need some sort of ordering for the classes which you define, you will be going either for a comparable or comparator interface. Consider this example package test; import java.util.*; public class TreeSetTest { private static Set<Person> s = new TreeSet<Person>(); public static void main(String a[]){ s.add(new Person(20)); s.add(new Person(30)); s.add(new Person(10)); s.add(new Person(50)); …
What is super and this keyword in java?
keyword : this ‘this’ is used for pointing the current class instance. It can be used with variables or methods. Look into the following example: class Test{ private int i=10; public void m(){ System.out.println(this.i); } } In the above code this is used for the current instance. Since this is instance of a class it …
How to use BitWise shift operator in Java?
They are called shift operators and they operate by shifting the number of bits being specified as an operand in the operation. >> —> Right shift Operator << —> Left Shift Operator >>> —-> Right bit with zero fill operator. The first two maintain the MSB when shifting thereby they maintain the sign of the …
What is the difference between JRE,JVM and JDK?
If you are a Java developer, it is very often that you think about understanding the JRE,JVM and JDK. Once if you understand these things, it would be quite easy for you to visualize things in logical manner. Also look at the picture below, that will clear all your questions about the JRE,JVM and JDK. …
Java HelloWorld vs Scala HelloWorld
As a first step into learning Scala and as one who is familiar with Java, let us compare the customary Helloworld programs in Java and Scala. You might already know that to run a Java program, there must be a public class with a main method that takes one parameter, a String[ ], and has a void …
Handling/Avoiding Null’s in Java using Guava versus Scala
There was a discussion about nulls in the latest episode of JavaPosse. Having been inspired from that discussion and with an urge to check out Google Guava library, I came across a way to handle Null’s in Guava which is very similar to the way Scala handles. also read: Java Tutorials Java EE Tutorials Design …