Write a method called friendlyNumbers that accepts two 4-digit integer parameters n1 and n2. The method will display whether n1 and n2 are friendly number or not. The header of the method is: public static void friendlyNumbers (int n1, int n2) Note that two integers are friendly if the first digit and the last digit of both numbers are the same. For example 3451 and 3981 are friendly numbers because both numbers starts with 3 and ends with 1, but 3450 and 4650 are not.

EBK JAVA PROGRAMMING
8th Edition
ISBN:9781305480537
Author:FARRELL
Publisher:FARRELL
Chapter3: Using Methods, Classes, And Objects
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
What is the solution for this question (using java language)
Write a method called friendlyNumbers that accepts two 4-digit integer
parameters ni and n2. The method will display whether ni and n2 are
friendly number or not.
The header of the method is:
public static void friendlyNumbers (int n1, int n2)
Note that two integers are friendly if the first digit and the last digit of both
numbers are the same. For example 3451 and 3981 are friendly numbers
because both numbers starts with 3 and ends with 1, but 3450 and 4650
are not.
Transcribed Image Text:Write a method called friendlyNumbers that accepts two 4-digit integer parameters ni and n2. The method will display whether ni and n2 are friendly number or not. The header of the method is: public static void friendlyNumbers (int n1, int n2) Note that two integers are friendly if the first digit and the last digit of both numbers are the same. For example 3451 and 3981 are friendly numbers because both numbers starts with 3 and ends with 1, but 3450 and 4650 are not.
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Multithreading 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:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT