Help me with my Java code

(Display patterns) Write a method to display a pattern as follows:
1 21 32 1

n n–1 … 3 2 1
The method header is
public static void displayPattern(int n)
Write a test program that prompts the user to enter a number n and invokes dis-
playPattern(n) to display the pattern.


Is this a school assignment? If so, we can’t give you answers, but we can point you in the right direction.

Ok point me bcz I am lost and I didn’t get anything from the professor :sweat_smile:

Well, for starters, do you know what a method is?