public char method(int n) { if (n >= 0 && n <= 9) { return (char) ('0' + n); } else if (n >= 10 && n <= 15) { return (char) ('A' + n } else { return '?'; 10)

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter8: Arrays
Section: Chapter Questions
Problem 20RQ
icon
Related questions
Question

Hey I need help, how would I compile this into java. Determine the valu of n in which the return of this method be A???

public char method (int n) {
if (n >= 0 && n <= 9) {
return (char) ('0' + n);
} else if (n >= 10 &&n <= 15) {
return (char) ('A' + n - 10);
} else {
return '?';
}
}
Transcribed Image Text:public char method (int n) { if (n >= 0 && n <= 9) { return (char) ('0' + n); } else if (n >= 10 &&n <= 15) { return (char) ('A' + n - 10); } else { return '?'; } }
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Math class and its different methods
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT