• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

To Peter

 
Ranch Hand
Posts: 8946
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Does the book cover Java Tiger features?
 
Ranch Hand
Posts: 445
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 8946
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 8946
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Java 5 introduces enhaced for loop. Why did Sun not use a new keyword foreach for this enchanced loop.
 
author
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 3178
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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...
 
Pradeep bhatt
Ranch Hand
Posts: 8946
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 8946
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the reply Peter!
Why is your book titled "Just Java"? :roll:
 
Pradeep bhatt
Ranch Hand
Posts: 8946
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 3178
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 8946
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
 
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 8946
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
 
reply
    Bookmark Topic Watch Topic
  • New Topic