<< Previous | Home

The Wonderful World Of Amazon Spam (Part 6)

This is the newest installment in my continuing series on Amazon spams (which I'm a fan of; see here, here, here, here, here). Although I have been receiving Amazon spams all the time, their quality has been declining to the extend that I can't distinguish them from spams from other retailers. That's why this classic Amazon spam caught my eye, and I think will make the whole day go a lot smoother. Enjoy!

Bonus quiz question

Q: What is EJB 3.1?

Tags :

Friday Java Quiz: Know Your Calendars And Dates

Once again, a late night Friday (Fri Aug 27 23:53:11 CDT 2010) Java quiz. This one arise out of work with Brian Coyner.

Q: Will the following Java program compile? Run without exceptions? If so, what does it print?

import java.util.Calendar; 
import java.util.Date; 
 
public class Main { 
    public static void main(String[] args) { 
        Date date = new Date(); 
        Date date2 = foo(date); 
        Date date3 = bar(date); 
        System.out.println("date2.getTime() == date3.getTime() = " + 
                (date2.getTime() == date3.getTime())); 
    } 
 
    private static Date foo(Date date) { 
        Calendar cal = Calendar.getInstance(); 
        cal.setTime(date); 
        cal.clear(Calendar.YEAR); 
        cal.clear(Calendar.MONTH); 
        cal.clear(Calendar.DATE); 
        cal.clear(Calendar.MILLISECOND); 
        return cal.getTime(); 
    } 
 
    private static Date bar(Date date) { 
        Calendar cal = Calendar.getInstance(); 
        cal.setTime(date); 
        Calendar cal2 = Calendar.getInstance(); 
        cal2.clear(); 
        cal2.set(Calendar.HOUR_OF_DAY, cal.get(Calendar.HOUR_OF_DAY)); 
        cal2.set(Calendar.MINUTE, cal.get(Calendar.MINUTE)); 
        cal2.set(Calendar.SECOND, cal.get(Calendar.SECOND)); 
        return cal2.getTime(); 
    } 
}

Lenient rules apply today: You are allowed to consult the JDK Javadocs and Google the internet. You are allowed to study the source code that comes with the JDK. However you do need to give your answer before you attempt to actually compile and run the program.

Oracle Sues Google Over Android

Oh boy! Is this real?

San Francisco Chronicle:

(08-12) 17:17 PDT Redwood Shores, Calif. (AP) --

Oracle Corp. said Thursday it has filed a patent and copyright-infringement lawsuit against Google Inc.

Oracle said in a statement that Google's Android system for mobile phones infringes on its patented Java technology.

This is the other shoe dropping in a story I reported 1221 days ago:

Here's an excerpt of a couple of comments from that post:

Re: Java: The Third Fork From Sun

Are you sure that it won't prevent ASF to release Harmony under the Harmony name without references to Java/JVM ?

As far as I understood it you are not granted patent licensing if you don't pass the JCK, so, I guess you are wrong in that statement.

Re: Java: The Third Fork From Sun

I'm speculating that Sun will not make any patent actions against Harmony even though the letter of the spec allows them that option. The PR backlash for such a thing would be unbearable.

A precedence of this sort of a situation is the relationship between Microsoft and Mono.

Things may play out differently, though.

Is this the end of Java as we know it?