I am new to Java and while I have gotten a grasp on several things, I am still uncertain about static and what it means.
I have a call I am needing to make to calculate a running total. I have this as my method:
[PHP]public double addTotal(double value)
{
total = total + value;
return total;
//method to tally value
}[/PHP]
(not sure if I am using the tags correctly, please let me know if I am not.)
and I have the call located in my main method
[PHP]CD[i].addTotal(value );//call to tally[/PHP]
While I am sure there is an easier way to do this, I am trying to get a grasp on the basics before I start using all the classes out there.
Here is my question: How can you call a method from within the main method? I have read and it seems to have something to do with my variable, value.
Thanks,
d
I have a call I am needing to make to calculate a running total. I have this as my method:
[PHP]public double addTotal(double value)
{
total = total + value;
return total;
//method to tally value
}[/PHP]
(not sure if I am using the tags correctly, please let me know if I am not.)
and I have the call located in my main method
[PHP]CD[i].addTotal(value );//call to tally[/PHP]
While I am sure there is an easier way to do this, I am trying to get a grasp on the basics before I start using all the classes out there.
Here is my question: How can you call a method from within the main method? I have read and it seems to have something to do with my variable, value.
Thanks,
d
Comment