Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within OCPJP
Search Coderanch
Advance search
Google search
Register / Login
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
Forum:
Programmer Certification (OCPJP)
Quick question about casting
Christian Joseph
Ranch Hand
Posts: 43
posted 12 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
in the seft
test
in the
SCJP
book
i get a mistake on this one
class Alien{ String invade(short ships){ System.out.println("few"); } String invade(short ... ships){ System.out.println("many"); } } class Defender{ public static void main(String[] args){ System.out.println(new Alien.invade(7)); //<----- is this argument transfer a "int" ?? } }
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
I like...
posted 12 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
you are passing int value to short argument, which is compile time error. because method invocation cant perform narrowing conversion!
Note: your invade method not having return statement!
Christian Joseph
Ranch Hand
Posts: 43
posted 12 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
thanks you clear my doubts!!! thanks RANCHERS!!! phew!
The only thing that kept the leeches off of me was this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
range of values
why compilation fails here
Casting????
scjp5.0 question
Assingment and casting
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
More...