1 error with an array "missing return statement"
        Posted  
        
            by 
                danielit0w
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by danielit0w
        
        
        
        Published on 2011-03-02T07:19:57Z
        Indexed on 
            2011/03/02
            7:25 UTC
        
        
        Read the original article
        Hit count: 308
        
java
import javax.swing.JOptionPane;
public class Mate {
double suma (double x1,double x2)
    {return x1+x2;}
double suma (double x1,double x2,double x3)
    {return x1+x2+x3;}
double suma (int num [ ])
    {int i=num.length;
     int j=0;
     int s=0;
for(j=0;j < i;j++)
{return (double)(s);}}} // here appears the error "missing return statement"
class AplicacionMate
{public static void main (String arg [])
    {int n[ ]={5,4,3,2,1};
     double r=0.0;
     Mate m=new Mate ( );
     r=m.suma(5,4);
     JOptionPane.showMessageDialog(null,"La suma 1="+r);
     r=m.suma(5,5,4);
     JOptionPane.showMessageDialog(null,"La suma 2="+r);
     r=m.suma(n);
     JOptionPane.showMessageDialog(null,"La suma del arreglo="+r);
     System.exit(0);}}
© Stack Overflow or respective owner