Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

[solved]warning message:" Accessing static method numbers" #7th floor

 
L Willie
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
[solved]no idea,may somebody give me some hints for the question?

Write a method to display a pattern as follows:

1
2 1
3 2 1
...
N n-1 3 2 1

The method header is
public static void displayPattern(int n) //Assumption: n <= 99

 
harilal ithikkat
Ranch Hand
Posts: 221
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator



OUTPUT
1

2 1

3 2 1

4 3 2 1

5 4 3 2 1

6 5 4 3 2 1

7 6 5 4 3 2 1

8 7 6 5 4 3 2 1

9 8 7 6 5 4 3 2 1

10 9 8 7 6 5 4 3 2 1


 
pete stein
Bartender
Posts: 1561
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
harilal ithikkat wrote:

impressive job of doing someone else's homework. good show.
 
L Willie
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
pete stein wrote:
harilal ithikkat wrote:

impressive job of doing someone else's homework. good show.

thank a lot
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64629
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
harilal ithikkat, please read this.
 
L Willie
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:harilal ithikkat, please read this.

is ok,i'll learn and understand from the answer,not only copy and submit homework.
 
L Willie
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


after i modified bit from the answer given by harilal ithikkat .
it can compile and run properly.
However,compiler promt warning message "Accessing static method numbers" on myAnswer.numbers();[line22]
What the warning message state about?
 
Campbell Ritchie
Sheriff
Posts: 48402
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're lucky Bear found this thread before I did. I would simply have deleted the solution.
 
Campbell Ritchie
Sheriff
Posts: 48402
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Static methods should be preceded by the name of the class, not the name of the object. If they are in the same class, you simply write the name of the method.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic