Showing posts from June, 2013

Tip: Null casting

When having overloaded methods in one class and calling one of these methods to pass the null value as a parameter. This causes ambiguity to the compiler to decide which method to use. So you can cast the null to the specific type for the method you want to call. Bellow is a snippet to make things clear. /**  *  * @author Belal  */ public class MyClass {     public void setObject(String s) {         System.out.println("In setObject(String s)");     }     public void setObject(Long l) {         System.out.println("In setObject(Long l)");     }     public static void main(String[] args) {         (new MyClass()).setObject("test");         (new MyClass()).setObject(new Long(0L));         (new MyClass()).setObject((String) null);         (new MyClass()).setObject((Long) null);     } } The output should be similar to this: In setObject(String s) In setObject(Long l) In setObject(String s) In setObject(Long l)

Java EE 7 arrives on 12 June

I have just received a newsletter email about the announcement of the Java EE 7 on 12 June, 2013. It's pretty interesting to learn more about the new features of the Java EE 7. The pig picture of the theme for the upcoming Java EE 7 as mentioned in the I <3 Java page on facebook is the following: Java EE 7 will help in: Delivering HTML5 dynamic, scalable applications Reducing response times, simplify JSON parsing, creating RIA using WebSocket, and delivering high-performance RESTful services. Increaseing developer productivity Simplifying architectures, reducing boilerplate code, adding more annotated POJOs, and enhancing portability. Exceeding enterprise requirements Processing batch jobs more efficiently, easily defining managed concurrent tasks, and simplifying application integration. You can visit this link and you will find there the registration link for the Live Webcast. References:- 1- I <3 Java facebook page. 2-