• Post Reply Bookmark Topic Watch Topic
  • New Topic

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

 
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


 
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


 
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
 
Author and ninkuma
Marshal
Posts: 66399
156
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?
 
Marshal
Posts: 57244
175
  • 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
Marshal
Posts: 57244
175
  • 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.
 
I'm not dead! I feel happy! I'd like to go for a walk! I'll even read a tiny ad:
The WEB SERVICES and JAX-RS Course
https://coderanch.com/t/690789/WEB-SERVICES-JAX-RS
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!