This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Private method

 
Zachary T. Anderson
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not getting any errors code but I know it is not right. First how do I return an ArrayList index of grade and be able to call it from another method. Second the Grade class is a second file that it is calling the grade from, so am I doing that part right. I don't even know how to test to see if it is call the date from the Grade class.

 
fred rosenberger
lowercase baba
Bartender
Pie
Posts: 12097
30
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how do I return an ArrayList index of grade

did you check the API? Maybe there is some way to get the index of an object in an ArrayList

and be able to call it from another method.

What do you mean "call it from another method"? Call what exactly?

Grade class is a second file that it is calling the grade from, so am I doing that part right.

umm...again, I'm not sure what you are asking here.

Part of the problem is that we are not seeing all your code. There are variables being used here that are not declared in what you posted, so it is impossible to really follow what is going on.

Note that I am not asking you to paste 500 lines of code in here...but you need to post enough that we can make sense of what you are doing.
 
Zachary T. Anderson
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I will look at the API about indexing the ArrayList. Once I get that looked at then maybe it will help me with the other parts so I don't have to paste parts of the code. As to the files Grade is a second class in a separate file and I am writing the code in the Student class. I will also need to call this method into another method that will allow me to remove the grade based on a date. That is why I wanted to know how to call it.
 
fred rosenberger
lowercase baba
Bartender
Pie
Posts: 12097
30
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If it is a private method, you can't call it from another class. That's kind of what private means.
 
Zachary T. Anderson
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That what I thought about the private method. The instructions say to make it a private method. Then we have to use what is found in the ArrayList in another part of the program.
 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Zachary T. Anderson wrote:That what I thought about the private method. The instructions say to make it a private method. Then we have to use what is found in the ArrayList in another part of the program.


Then either:

A) The instructions are faulty, by virtue of being impossible to implement, or at least by being ambiguous.
or
B) You are misunderstanding some nuance of the instructions.

If you paste in the exact, complete instructions, somebody here can probably tell you which, and help clarify any ambiguity in the instructions or misunderstanding on your part.

For example, it might be that one or more public methods are meant to use that private method in their execution.
 
Zachary T. Anderson
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was reading it wrong. I took a look again and broken the problem down so that I worked on piece by piece. It is a private method and I don't call it any where else.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic