Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

arrays print help?  RSS feed

 
orry kaplan
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi, i am trying to print these arrays however it is coming up with an error on one part (listed below)




I am sooo confused as to why this is showing, any help?
 
Carey Brown
Bartender
Posts: 2991
46
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
2 things would help us help you: 1) show all of your code, 2) copy-n-paste error message(s) into your post.

PrintDataArray(ArrayA);

Do you have such a method? What argument is the method expecting?
 
orry kaplan
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Carey Brown wrote:2 things would help us help you: 1) show all of your code, 2) copy-n-paste error message(s) into your post.

PrintDataArray(ArrayA);

Do you have such a method? What argument is the method expecting?


This is all of the code i have. And my error message i got is, " The method PrintDataArray(ArrayList<Data>) is undefined for the type PJ1"
 
Carey Brown
Bartender
Posts: 2991
46
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
orry kaplan wrote:
Carey Brown wrote:2 things would help us help you: 1) show all of your code, 2) copy-n-paste error message(s) into your post.

PrintDataArray(ArrayA);

Do you have such a method? What argument is the method expecting?


This is all of the code i have. And my error message i got is, " The method PrintDataArray(ArrayList<Data>) is undefined for the type PJ1"

It's telling you you haven't defined this method so you'll need to define it.
 
Carey Brown
Bartender
Posts: 2991
46
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
orry kaplan wrote:This is all of the code i have. And my error message i got is, " The method PrintDataArray(ArrayList<Data>) is undefined for the type PJ1"

What is PJ1 ?
 
orry kaplan
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Carey Brown wrote:
orry kaplan wrote:This is all of the code i have. And my error message i got is, " The method PrintDataArray(ArrayList<Data>) is undefined for the type PJ1"

What is PJ1 ?


Thats just the name of the project. Do you know what the problem is and how i can possibly fix it?
 
Carey Brown
Bartender
Posts: 2991
46
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Carey Brown wrote:2 things would help us help you: 1) show all of your code, 2) copy-n-paste error message(s) into your post.
 
Vibhor Rawat
Greenhorn
Posts: 9
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
orry kaplan wrote:
Carey Brown wrote:2 things would help us help you: 1) show all of your code, 2) copy-n-paste error message(s) into your post.

" The method PrintDataArray(ArrayList<Data>) is undefined for the type PJ1"


Above statement itself is the problem definition. You need to define PrintDataArray() in your class. Besides, it would be very helpful if you share whole code here.
 
Dave Tolls
Rancher
Posts: 2911
35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
orry kaplan wrote:[
This is all of the code i have.


How can this be all the code?
There isn't even a class definition.
 
orry kaplan
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dave Tolls wrote:
orry kaplan wrote:[
This is all of the code i have.


How can this be all the code?
There isn't even a class definition.


 
Carey Brown
Bartender
Posts: 2991
46
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For starters

Here you are defining a method whose name is "method", not PrintDataArray.
You are expecting a parameter of type String[] instead of an ArrayList<Data>.
Your parameter name is PrintDataArray, which is ok unto itself, but should ideally be a different name than the name of the method.
 
Carey Brown
Bartender
Posts: 2991
46
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Secondly you're attempting to define PrintDataArray inside the main() method. Java doesn't accept nested methods. You can have nested calls, but not nested definitions.

Edit: Define it after main()'s '}' and before the class' '}'.

Nit:
The Java convention is for method names to start  with a lower case letter.
 
Knute Snortum
Sheriff
Posts: 4073
112
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dave Tolls wrote:
orry kaplan wrote:[
This is all of the code i have.


How can this be all the code?
There isn't even a class definition.

The code you posted doesn't compile. (Carry points out one reason why).  Please post the entire code, exactly as you have written it, that compiles and runs, or produces an error.  If the latter, please post the entire error message.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!