• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

arrays print help?

 
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Bartender
Posts: 10964
87
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows ChatGPT
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 10964
87
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows ChatGPT
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 10964
87
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows ChatGPT
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 10964
87
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows ChatGPT
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.

 
Greenhorn
Posts: 9
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.

 
Rancher
Posts: 4801
50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 10964
87
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows ChatGPT
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 10964
87
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows ChatGPT
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 7126
185
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Everyone is a villain in someone else's story. Especially this devious tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic