aspose file tools*
The moose likes Beginning Java and the fly likes To Peter Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "To Peter" Watch "To Peter" New topic
Author

To Peter

Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919

Does the book cover Java Tiger features?


Groovy
Vedhas Pitkar
Ranch Hand

Joined: Jan 27, 2001
Posts: 445
Hi Pradeep
I saw the book's reviews on Amazon & the reviewers have said that it does cover Tiger (J2SE 5).
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919

Peter,

I would also like to know your opinion about static import in Java Tiger. I feel that it should not have been introduced.
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919

Java 5 introduces enhaced for loop. Why did Sun not use a new keyword foreach for this enchanced loop.
Peter van der Linden
author
Ranch Hand

Joined: Sep 28, 2004
Posts: 46
Yikes! What a lot of questions, Pradeep.

Let me take a few minutes to give my thoughts.

First, YES! Just Java 6th Edition has full coverage of the Tiger features, J2SE 5!
As a matter of fact, when I was researching the book, I got interested in how, and how
much Java had changed over the 6 major release it has had, and I put together a chart
to help me understand it. Then I thought that readers might be interested in that
information too, so I put it into JJ6, in the Preface to be precise.

Second, static import - as you point out, it was not strictly necessary, you could go on
using the long form of static names. Or the language rules could even be changed to
allow the effect of static import without the "static" keyword.

I had a long discussion with the compiler-writer at Sun responsible for the design
choices in this case. He was of the view that the best tradeoff was to help programmers
see which names are static members of a class. I have got a lengthy discussion of this
on page 126 of Just Java 6th Ed, if you have a copy handy. So agree with it or not, that
is the reasoning.

I'll come back to the question of enhanced for loop as it raises some interesting issues.

Cheers!

Peter


Author of <a href="http://www.amazon.com/exec/obidos/ASIN/0131482114/ref=jranch-20" target="_blank" rel="nofollow">Just Java(TM) 2 (6th Edition)</a>
Ko Ko Naing
Ranch Hand

Joined: Jun 08, 2002
Posts: 3178
Since there are a lot of arguments about this static import feature in Tiger, do u think that they will consider eliminating this feature in the next release of J2SE 5.1 or sthing? Or is it just a small weak point of Tiger that we can ignore it? :roll:

Pradeep, me and Nick, discussed about it one time, when we were in the last book promotion about Mr.Herb's Tiger book... I can still remember it... It's good that we can get opinions from great authors like this...

Thanks the Ranch for such a great opportunity, which we cannot get elsewhere...


Co-author of SCMAD Exam Guide, Author of JMADPlus
SCJP1.2, CCNA, SCWCD1.4, SCBCD1.3, SCMAD1.0, SCJA1.0, SCJP6.0
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919

Or is it just a small weak point of Tiger that we can ignore it


Java 5 was supposed to make Java stronger but..
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919

Thanks for the reply Peter!
Why is your book titled "Just Java"? :roll:
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919

Peter,

I also have a question regarding Autoboxing. It reduces the code but comes with a performance price. Dont you think that we should avoid using it.

Also, == operator behaves differently for primitives and Object datatypes.
Please give us your thoughts on this.

Thanks
Ko Ko Naing
Ranch Hand

Joined: Jun 08, 2002
Posts: 3178
Originally posted by Pradeep Bhat:
Also, == operator behaves differently for primitives and Object datatypes.


It should behave differently, shouldn't it? == operator is overloaded in the JLS and they would behave according to the type of the operands...

Or do u want to mean some other things, Pradeep?
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919

Originally posted by Ko Ko Naing:


It should behave differently, shouldn't it? == operator is overloaded in



That is the problem.
http://jroller.com/page/eu/20040705#autoboxing_surprises
Anushe Khan
Ranch Hand

Joined: Dec 13, 2003
Posts: 74
quote:
I also have a question regarding Autoboxing. It reduces the code but comes with a performance price. Dont you think that we should avoid using it.
===========================================================================


Avoid doing it in a loop.
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919

Originally posted by Pradeep Bhat:
Peter,

I also have a question regarding Autoboxing. It reduces the code but comes with a performance price. Dont you think that we should avoid using it.

Also, == operator behaves differently for primitives and Object datatypes.
Please give us your thoughts on this.

Thanks


Regarding performance I was refering to the last example in the link below
http://java.sun.com/j2se/1.5.0/docs/guide/language/autoboxing.html
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: To Peter