Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4022308
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T10:27:32+00:00 2026-05-20T10:27:32+00:00

import javax.swing.JOptionPane; public class Mate { double suma (double x1,double x2) {return x1+x2;} double

  • 0
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);}}
  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T10:27:33+00:00Added an answer on May 20, 2026 at 10:27 am

    I took the liberty of formatting your code. This is how the method looks:

    double suma (int num [ ]) {
        int i=num.length;
        int j=0;
        int s=0;
    
        for(j=0;j < i;j++) {
            return (double)(s);
        }
    }
    

    I suspect you attempted to write a sum-method, started with a stub, and didn’t get it to compile. This is probably what you had in mind:

    double suma (int num [ ]) {
        int i=num.length;
        int j=0;
        int s=0;
    
        for(j=0;j < i;j++) {
            // here you probably want s += num[j];
        }
    
        return (double)(s);
    
    }
    

    The Java compiler can only deduce that a statement (such as a return) is reachable in very simple cases. (To illustrate: this method does compile. Still not very useful though!)

    double suma (int num [ ]) {
        int i=num.length;
        int j=0;
        int s=0;
    
        for(j=0; true; j++) {
            return (double)(s);
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

import javax.swing.JOptionPane; public class RotateArrayCircularLL { private Node head=null; public void init() { int
Here is my code: import javax.swing.*; import java.awt.*; public class PanelModel { public static
Here is the code: import javax.swing.*; import java.awt.event.*; import java.awt.*; public class TestGrid {
Here I found this code: import java.awt.*; import javax.swing.*; public class FunWithPanels extends JFrame
import java.util.scanner; import javax.swing.JOptionPane; public class FirstHomeJavaApplet{ public static void main(String[] args){ int num1=2;
import java.awt.Component; import java.awt.Dimension; import java.awt.Toolkit; import javax.swing.JOptionPane; public class NewJFrame extends javax.swing.JFrame {
import java.io.FileNotFoundException; import java.lang.SecurityException; import java.util.Formatter; import java.util.FormatterClosedException; import java.util.NoSuchElementException; import javax.swing.JOptionPane; public class
import java.io.FileNotFoundException; import java.lang.SecurityException; import java.util.Formatter; import java.util.FormatterClosedException; import java.util.NoSuchElementException; import javax.swing.JOptionPane; public class
import javax.swing.JOptionPane; public class PredefinedClass { public static void main(String[] args){ do{ String input
import javax.swing.JOptionPane; import java.text.DecimalFormat; public class CandleLine { public static void main(String[] args) {

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.