Agility eLetter May 2005
|
In this issue... In this issue, we have a detailed article on Generics in Java: Part-III. Abstract: In Part-I and II we discussed the benefits and usage of Java Generics, and how it is implemented under the hood. In this Part-III, we conclude with discussions on issues with mixing generic and non-generic (raw-type) code, and the issues of converting a non-generic legacy code to generics. Please visit http://www.agiledeveloper.com/download.aspx to download the complete article from the Agile Developer web site. |
||
|
Message from us
|
||
|
Quiz corner This month’s quiz has double dip bonus. The person with first correct response will earn
two special prizes! Let's see who the lucky, err, I mean, smart winner is! namespace CallWS { class
Test { static void CallService() { wsmay2005.Service1
service =
new CallWS.wsmay2005.Service1(); int start = Environment.TickCount; service.GetInfo(); int end = Environment.TickCount; Console.WriteLine("Time elapsed {0}",
(end - start)/1000); } static void CallServiceAsynch() { wsmay2005.Service1
service =
new CallWS.wsmay2005.Service1(); int start = Environment.TickCount; service.BeginGetInfo(
new AsyncCallback(CallReturned), start); } static void CallReturned(IAsyncResult ar) { int end = Environment.TickCount; int start = (int) ar.AsyncState; Console.WriteLine("Time elapsed {0}",
(end - start)/1000); } [STAThread] static void { Console.WriteLine("Making two synchronous
calls"); CallService(); CallService(); Console.WriteLine("Making four asynchronous
calls"); CallServiceAsynch(); CallServiceAsynch(); CallServiceAsynch(); CallServiceAsynch(); Console.ReadLine(); } } }
Fix the above code (minimum change) so I get the following output: Making two synchronous
calls Time elapsed 2 Time elapsed 2 Making four asynchronous
calls Time elapsed 2 Time elapsed 2 Time elapsed 2 Time elapsed 2 There should still be two synchronous calls and four asynchronous calls. Send in your response and if your response is the first correct response, you will be the winner of the double dip bonus! Send your response to agility@agiledeveloper.com. This year, each person with the first correct response to the quiz in each issue of Agility will win a special prize. Quiz from the past issue In Java 5, the technique of ____ replaces parameterized type with a type during compilation. Answer! It’s
erasure. |
||
|
Subscription Information To subscribe or unsubscribe to the free issues of Agility eLetter, please visit http://www.agiledeveloper.com/eLetter.aspx. |
||
|
Thus spake... "A life spent making mistakes is not
only more honorable but more useful than a life spent doing nothing,"
George Bernard Shaw. |