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
Tim Cooke
Liutauras Vilda
Jeanne Boyarsky
paul wheaton
Sheriffs:
Ron McLeod
Devaka Cooray
Henry Wong
Saloon Keepers:
Tim Holloway
Stephan van Hulst
Carey Brown
Tim Moores
Mikalai Zaikin
Bartenders:
Frits Walraven
Forum:
Programmer Certification (OCPJP)
Quick question about casting
Christian Joseph
Ranch Hand
Posts: 43
posted 13 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 13 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 13 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
thanks you clear my doubts!!! thanks RANCHERS!!! phew!
See where your hand is? Not there. It's next to this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
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...