I would create a score object that has two attributes total score and total
extra. You can then modify the attributes and return one score object.



On Thu, Oct 15, 2009 at 3:02 AM, mcalex <[email protected]> wrote:

>
> no, I don't think you can do this.
>
> From the language spec: (http://java.sun.com/docs/books/jls/
> third_edition/html/classes.html<http://java.sun.com/docs/books/jls/%0Athird_edition/html/classes.html>
> )
> 8.4.5 Method Return Type
> The return type of a method declares the type of value a method
> returns, if it returns a value, or states that the method is void.
>
> This infers that a method can either return _a_ value, or void.
>
>
> To get around this, you could wrap your return values in an array,
> maybe.
>
> On Oct 15, 2:44 pm, John Joseph <[email protected]> wrote:
> > Hi
> >    I want to return values of two variables  "totalscore" and "totalextra
> "in a method  , for example can I do like this
> >
> >   public static int calcTotal( FootballScore[] f ) {
> >         int totalscore = 0;
> >         int totalextra = 0;
> >       for ( int i = 0; i < f.length; ++i ) {
> >               total += f[i].score ;
> >               totalextra += f[i].extras;
> >       }
> >       return totalscore;
> >       return totalextra;
> >     }
> >
> >       From cricket scores to your friends. Try the Yahoo! India Homepage!
> http://in.yahoo.com/trynew
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/javaprogrammingwithpassion?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to