This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes generic program error 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 » Java » Beginning Java
Bookmark "generic program error" Watch "generic program error" New topic

generic program error

kumarth ravi
Ranch Hand

Joined: Jun 01, 2007
Posts: 48

when 34 is passed ,then it will be converted into the Integer Object and passed to the constructor.So, when this code "u.byteValue()" ,which is in the display() method should be compiled properly,but it is throwing the error(because here 'u' is treated as a object)

Compiling 1 source file to C:\deploy\pbnm\class\build\classes
C:\deploy\pbnm\class\src\ cannot find symbol
symbol : method byteValue()
location: class java.lang.Object
1 error
BUILD FAILED (total time: 0 seconds)
Paul Sturrock

Joined: Apr 14, 2004
Posts: 10336

Not an advanced question. Moving...

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
kumarth ravi
Ranch Hand

Joined: Jun 01, 2007
Posts: 48
It may not be the advanced question,but I want the answere,where can I get the answere

Keith Lynn
Ranch Hand

Joined: Feb 07, 2005
Posts: 2398
But look at it from the compiler's point of view. It has no way of knowing what class U will be.

The only thing the compiler knows for sure is that U is a subclass of Object.

So it can only let you call methods on the variable you that are defined in Object.
I agree. Here's the link:
subject: generic program error
It's not a secret anymore!