Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!

Tanakorn Numrubporn

Ranch Hand
+ Follow
since Dec 11, 2006
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Tanakorn Numrubporn

This below code doesn't work


But this below code is work



The problem is 'Why the thing happen like this?'. I think the generic array creation is look quite right in my view.

When I compile with the below code (the worked version) the compile is warn me about 'unsafe and uncheck condition' but if I use the first code (the doesn't worked version) the compiler is block me from working. I don't know how to make the code both compile and don't be warn.
[ May 12, 2007: Message edited by: Tanakorn Numrubporn ]
Thank you for reply.
Now I try to use JDeveloper and it serve my will so well. I can use this tool to generate master/detail form in wizard style and I can turn to look in the java code that support behind this form style.
I'm new for JDBC and I want to create master/detail form (like mainform/subform of msAccess OR master/detail form of Oracle). I google for several web and several day for this topic but can't find any information. I using Eclipse and find the 'org.eclipse.ui.forms' package but I have no knowledge to use it. May you(anyone) please reply to me the suggestion or the site that say something about this form style.

Thank you in advance
Tanakorn
Oop! sorry I know I paste the lib folder in the wrong place. Now I can run it. Sorry for bother the forum with my un-careful manner.
I reach the chapter 9 of HFSJ and run the first example of the chapter. This is my result.jsp code. Suppose that "movieList" attribute was already set in Ch9Servlet.class.



and this is my web-apps folder architecture.



When I run on firefox, it told me that:



How can I solve this problem? Thank you for any suggestion.

Tanakorn
[ March 22, 2007: Message edited by: Tanakorn Numrubporn ]
I use tomcat 5.5.20 and I following the chapter8 of HFSJ book. In the "type attribute" topic (page 353-355)
This is my servlet code.


and "attribute code"


and the result.jsp code



The problem is: when I use the above result.jsp the container will produce the error page. But if I modify the .jsp file to



Then the .jsp page will work fine and show the result without error.

Even if I edit the servlet code from



TO



The page is also work fine, even though the "new Person();" is exactly wrong syntax for java (Person is abstract class) but it work.

I don't understand the tomcat behavior, that act not according to the book.

PS. I recompile the code every time I change it, so it is not the "version" relate problem.

Thank you
Tanakorn
Superp
Congratulation for the excellence score.
13 years ago
I don't know the word 'you-know-who' make you feel good or not? I just want to said the book that the everyone in this forum is familiar. If it sound rudeness I'm so sorry and I edit the topic so it look fine.

Sorry but sincere
Tanakorn
13 years ago
The exam is harder than I was expected. But I passed it with 86% scores and it not bad for a java newbie like me.

Thank for the book of K&B for great content and detail, without your book I can't passed this exam. Now I can concentrate to my thesis and another cert: SCWCD.

Thank
Tanakorn Numrubporn
[ March 01, 2007: Message edited by: Tanakorn Numrubporn ]
13 years ago
Let enjoy of your success. Your score is extremely good . Next month I will take the exam too and I hope I can get good score (e.g. 80 will ok for me).
13 years ago
First, don't take it too hard. I just post it for fun (but it is correct thing except that it can't be consider the useful one). This is the code:

assume that the Animal and its subclass is correct implements.


This code is work fine, which mean it 'fine' both in compile and run time. I can invoking addAnimal( List<Dog> ) , addAnimal( List<Cat> ) as it was in wildcard generics fashion.

The point is, the method that declare wild cards generic (e.g. List<? extends SuperClass> can't invoking the 'modify' method such as add() of List. But you can add 'null' in this method and this 'null' will distribute to every List that you add to this method.

Best Regards
Tanakorn
[ February 11, 2007: Message edited by: Tanakorn Numrubporn ]

Originally posted by Henry Wong:


Interestingly, while the keySet() and entrySet() method do return a collection object, it is actually the same collection. Both of those methods return an instance of an inner class that accesses the Map data directly. It does not "send the key element to set variable", the "set" that is returned is just a different interface to the same collection.

Henry



Thank you very much. I think that I get the benefit from this post, the keySet() will return the instance of inner class of map is new knowledge for me . And I think Arrays.asList() has same behavior like keySet(), which return the instance of inner class and refer to the same data, is it right?

Thank you again.
I just reread the K&B book for final stage before take the exam. I read in the collections chapter and I find the think that I was suspected for a long time (but I not realize it):

When you use the the map interface's implementor(e.g. HashMap or Hashtable). When you want to traverse through its elements you have to use the keySet() method to send the key element to set variable and then use the iterator() method for traversing it.

Why Map interface has no iterator() method? It will be easier to iterate the map elements if it has a iterator() method of it own.

Thank you