• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Float wrapper class??

 
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Guys,

The code below is from here

import java.util.*;
public class TechnoSample {
public static void main(String[] args) {
Vector col = new Vector();
col.add(new Integer(1));
col.add(new Integer("2"));
col.add(new Float(3.2d));//line 1
col.add(col.elementAt(1));
col.setElementAt(col.elementAt(2),0);
System.out.println(col);
}
}

Actually it compiles fine. I thought that it gives error at line 1?? Does the Float constructor accepts a double argument??? Also does a Double constructor accepts a float as argument?? How is all this possible??
[ December 19, 2006: Message edited by: Jothi Shankar Kumar Sankararaj ]
 
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Would someone please be kind enough look at the API for Float and Double and tell Jothi the answers. I'm just now feeling a little too lazy to bother to do it myself. :roll:
 
Joe San
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok, I looked at the API and it says that Float has 3 constructors, one that takes a double as argument. Why didn't any of the books mention this one small thing in their wrapper class discussion?? I didn't find this in the K&B, Khalid Mughal...Is this not specific for the exam?? Only the Float class has 3 constructor?? Why is this so??
 
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There are plent y of tiny "idiosyncracies" that are nowhere mentioned in K&B and probably other Java books. You need to explore them yourself.
 
Joe San
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do you know about any such other things?? If you can share that here, that would be of great help to all the ranchers.
 
Ranch Hand
Posts: 961
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When I was studying for the SCJP exam I did a few things to avoid these pitfalls. I can recommend those same strategies to you. If you find them helpful then use them, otherwise just ignore my remarks.

One of the most important things that I did while studying for the exam is that I installed the JDK API documentation and I studied every single class in the java.lang and java.util package from it.

I never felt satisfy with a simple explanation of the book, I wanted to master every class. In order to do that I wrote dozens of examples with every class and I made a effort to understand what was the purpose of every single method. When I did the exam a couple of years ago I knew by heart every single class in the package, I knew static and non-static methods, their signatures and return types.

I also learned by heart the hierarchy of all collections.

All this may sound a bit exaggerated, it is up to you. All I can tell you is that it has really helped me a lot.

Something else I did that really helped me was to read the Java Language Specification.

Go over the examples in the Java Almanac.

And one of the most helpful things was trying to reply questions in this forum.

Sometimes I could not, but when I did not know the answer I did all the research to find out. Little by little I was replying to some questions myself.

So, keep up, and do not let this details let you down.

My final recommendation is: first research, and if you cannot find answer then ask. Even better if you ask for the place where the information is hidden instead of the answer itself, because when you do the research yourself it is not only more rewarding, but you learn things better.
 
Joe San
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What you say is absolutely true. With just a week for my exam, I don't think that I will be able to do all of what you have said. Anyways, atleast for the Collections framework, I can do that and go. Thanks for the comments.
 
author
Posts: 9050
21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Guys, hi Edwin,

I'd like to give a little background about our intentions for the objectives we created for the exam. We certainly were not interested in having thousands of people memorizing tiny details about random aspects of the API. Instead, our intention was for people to understand the important aspects of some of the most commonly used packages. Our hope was that after studying the APIs in the objectives, candidates will have a good sense of how the APIs work in general, and how to use the docs.

So, long story short, you guys are certainly free to do the amount of memorization that Edwin is talking about, but imho it's not really necessary... either for the exam or for your Java future.

hth,

Bert
 
reply
    Bookmark Topic Watch Topic
  • New Topic