#OOPs
14 messages · Page 1 of 1 (latest)
⌛ This post has been reserved for your question.
Hey @eager acorn! Please use
/closeor theClose Postbutton above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
looks like since you declared primitive short, primitive method argument is preferred over wrapper
but why didn't the same thing happen in Long
because short to int conversion isnt lossy
long > int > short
you can up cast but not downcast
/run
int x = 4;
short y = x;
@spiral glacier I only received java(15.0.2) error output
file0.code.java:3: error: incompatible types: possible lossy conversion from int to short
short y = x;
^
1 error
error: compilation failed
Your java(15.0.2) code ran without output @spiral glacier
Okayy