File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes One doubt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "One doubt" Watch "One doubt" New topic

One doubt

Rajeswari Kumar

Joined: Mar 23, 2007
Posts: 26
This is a question from whizlabs.

class AutoBox2 {
public static void main(String []ar) {
Float F=new Float(9.0);
float f=(float)9.0;
When I am trying to compile the program, following error has come float cannot be dereferenced
1 error
What is called dereferencing. But if it is given as
code compiles fine. Please explain me.
anil kumar
Ranch Hand

Joined: Feb 23, 2007
Posts: 447

Here f is primitive.How can you call a method on primitive variable ?


Anil Kumar
Rajeswari Kumar

Joined: Mar 23, 2007
Posts: 26
Yes Yes. Thanku. It didn't strike for me.
I agree. Here's the link:
subject: One doubt
It's not a secret anymore!