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
Win a copy of
Cloud Application Architecture Patterns: Designing, Building, and Modernizing for the Cloud
this week in the
Cloud/Virtualization
forum!
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
paul wheaton
Paul Clapham
Ron McLeod
Sheriffs:
Jeanne Boyarsky
Liutauras Vilda
Saloon Keepers:
Tim Holloway
Carey Brown
Roland Mueller
Piet Souris
Bartenders:
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!
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...