This should work? error missing return statement.

Why do I get this error?
missing return statement
To me the code seems good?
public SortAbstractProduct createSorter(String whichAlgorithm) {
if (whichAlgorithm.equalsIgnoreCase("BubbleSortProduct") )
System.out.println("from scf buublesort check");
return new BubbleSortProduct();
if (whichAlgorithm.equalsIgnoreCase("OptimsedBubbleSortProduct") )
System.out.println("from scf optimesed buublesort check");
return new OptimisedBubbleSortProduct();
if (whichAlgorithm.equalsIgnoreCase("QuickSortProduct") )
System.out.println("from scf Quicksort check");
return new QuickSortProduct();
}

You need to retrun an object of SortAbstractProduct, yet your are trying to return 3 different types(BubbleSortProduct, OptimisedBubbleSortProduct, QuickSortProduct). These need to be subclasses of SortAbstractProduct, then you will be able to cast them it.

Similar Messages

  • Compiler Error, Missing Return Statement

    This line of code for the begining of a method that reads a file always throws the compiler error, missing return statement. I can't figure out how to fix it!
    public String[] read(InputStream list) throws Exception {
    Could someone please help?

    you might need to post more code, but basically the
    compiler is complaining because you do not have a
    return statement at the end of your method.
    if you do not have a return statement (with a matching
    return type) then the compiler will complain. If you
    don't understand this then post the code to your
    method and we can get it fixed.
    public String[] read(InputStream list) throws
    Exception {
    String[] stringArray;
    return stringArray;
    The code is the most complex I have written so far but here is some of it. (the begining and the end)
    public String[] read(InputStream list) throws Exception {
    if (list != null) {
    String[] stringArray = null;
    try {
    while {
    //add strings to string array
    }//end of while
    return stringArray;
    }// end try
    catch{
    }//end of method

  • Compile Error: missing return statement

    anyone knows why the following program yields compile error "missing return statement??"
    class LengthTest
         public int stringLength(String s)
         {     int len = s.length();
              if (len <= 5) return 5;
              else if (len <= 10) return 10;
              else if (len <= 20) return 20;
    //          else return 30;
    If I add "else return 30" statement, then it can stop the error. Any ideas??

    You might know that the string length will never be more than 20, but the compiler does not. So it forces you to supply a return statement that will be executed no matter what the string length is.

  • "missing return statement" error code

    well... i feel like such a n00b... I can't seem to figure out what the problem is with my code, if someone could help me, that would be great. I get an error saying 'missing return statement'. I know that I have some things in here that I don't need but I will need them as I go on making this program.
    with this code:
    import java.io.*;
    import java.math.*;
    public class Tester
         public static int time = 0;
         public static void main(String[] args) throws IOException
              System.out.println("Welcome to the 2008 Java Games!!!");
              time=1000;
              delay(100);
              //Method Name: delay
              //Method Arguments: used to wait for a given time
              //Goal of Method: Delay for a given time
         public static int delay(int time)
              try {
                   Thread.sleep(time);
              catch(InterruptedException ex) {}
              time++;
    }

    What does the error say? "Missing return statement"? Then I'm going to venture a guess and say that you're missing a return statement. If you don't know what a return statement is, then you have some learning to do:
    http://java.sun.com/docs/books/tutorial/java/javaOO/returnvalue.html
    Read that, then look at your delay() method and how you call it. And notice that you've made delay() of type "int".
    Edit: Or just have someone else give you the answer :P
    Edited by: newark on Feb 27, 2008 3:20 PM

  • Cannot resolve "missing return statement error"

    Hi,
    I have a small code where the following message is received when I am trying to compile it:
    61: missing return statement
    ^
    1 error
    I cannot figure out what is the source of the error. I appreciate any help in advance. Thanks
    THE FULL CODE:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class BuildSquare extends JApplet
    implements ActionListener {
    JLabel number1Label, resultLabel;
    JTextField number1Field, resultField;
    public void init()
    Container container = getContentPane();
    container.setLayout( new FlowLayout() );
    number1Label = new JLabel("Enter an integer to represent the side of square" );
    container.add(number1Label);
    number1Field = new JTextField( 10 );
    container.add( number1Field );
    number1Field.addActionListener( this );
    resultLabel = new JLabel ("The final square is: ");
    container.add( resultLabel );
    resultField = new JTextField( 15);
    resultField.setEditable( false );
    container.add( resultField);
    public void actionPerformed( ActionEvent e )
         int a;
    String Result;
         a = Integer.parseInt(number1Field.getText());
         showStatus("Calculating...");
         Result = DisplaySquare( a );
         showStatus( "Done");
         resultField.setText( Result );
    public String DisplaySquare( int a )
    String output = "";
    for (int row = 1; row <= a; row ++) {
    for (int column = 1; column <= a; column++ ) {
    output += output + "* ";
    output += "\n";
    return output;
    }

      public String DisplaySquare( int a )
       String output = "";
        for (int row = 1; row <= a; row ++)
           for (int column = 1; column <= a; column++ )
               output += output + "* ";
            } // end of "for  clumn"  
            output += "\n";
            return output;
        }  //end of "for   row"
        //mising return...............
      }  //end of public String DisplaySquare
    } //end of public class BuildSquare

  • Loading a js file gives this error: "missing ; before statement .. Line 1"

    After "Clearing Recent History" Cache
    The Error console shows:
    Error: missing ; before statement
    Source File: http://www.dmv-rom.ca/res2/res/js/modaldbox.js
    Line: 1, Column: 14
    Source Code:
    Date: Mon, 22 Aug 2011 20:05:41 GMT
    and points to the A in Aug
    The file content:
    * Modal Dialog Box
    * copyright 8th July 2006 by Stephen Chapman
    * http://javascript.about.com/
    * permission to use this Javascript on your web page is granted
    * provided that all of the code in this script (including these
    * comments) is used without any alteration
    function pageWidth() {return window.innerWidth != null? window.innerWidth: document.documentElement && document.documentElement.clientWidth ? document.documentElement.clientWidth:document.body != null? document.body.clientWidth:null;}function pageHeight() {return window.innerHeight != null? window.innerHeight: document.documentElement && document.documentElement.clientHeight ? document.documentElement.clientHeight:document.body != null? document.body.clientHeight:null;}function posLeft() {return typeof window.pageXOffset != 'undefined' ? window.pageXOffset:document.documentElement && document.documentElement.scrollLeft? document.documentElement.scrollLeft:document.body.scrollLeft? document.body.scrollLeft:0;}function posTop() {return typeof window.pageYOffset != 'undefined' ? window.pageYOffset:document.documentElement && document.documentElement.scrollTop? document.documentElement.scrollTop: document.body.scrollTop?document.body.scrollTop:0;}function $mdbox(x){return document.getElementById(x);}function scrollFix(){var obol=$mdbox('ol');obol.style.top=posTop()+'px';obol.style.left=posLeft()+'px'}function sizeFix(){var obol=$mdbox('ol');obol.style.height=pageHeight()+'px';obol.style.width=pageWidth()+'px';}function kp(e){ky=e?e.which:event.keyCode;if(ky==88||ky==120)hm();return false}function inf(h){tag=document.getElementsByTagName('select');for(i=tag.length-1;i>=0;i--)tag[i].style.visibility=h;tag=document.getElementsByTagName('iframe');for(i=tag.length-1;i>=0;i--)tag[i].style.visibility=h;tag=document.getElementsByTagName('object');for(i=tag.length-1;i>=0;i--)tag[i].style.visibility=h;}function sm(obl, wd, ht){var h='hidden';var b='block';var p='px';var obol=$mdbox('ol'); var obbxd = $mdbox('mbd');obbxd.innerHTML = $mdbox(obl).innerHTML;obol.style.height=pageHeight()+p;obol.style.width=pageWidth()+p;obol.style.top=posTop()+p;obol.style.left=posLeft()+p;obol.style.display=b;var tp=posTop()+((pageHeight()-ht)/2)-12;var lt=posLeft()+((pageWidth()-wd)/2)-12;var obbx=$mdbox('mbox');obbx.style.top=(tp<0?0:tp)+p;obbx.style.left=(lt<0?0:lt)+p;obbx.style.width=wd+p;obbx.style.height=ht+p;inf(h);obbx.style.display=b;return false;}function hm(){var v='visible';var n='none';$mdbox('ol').style.display=n;$mdbox('mbox').style.display=n;inf(v);document.onkeypress=''}function initmb(){var ab='absolute';var n='none';var obody=document.getElementsByTagName('body')[0];var frag=document.createDocumentFragment();var obol=document.createElement('div');obol.setAttribute('id','ol');obol.style.display=n;obol.style.position=ab;obol.style.top=0;obol.style.left=0;obol.style.zIndex=998;obol.style.width='100%';frag.appendChild(obol);var obbx=document.createElement('div');obbx.setAttribute('id','mbox');obbx.style.display=n;obbx.style.position=ab;obbx.style.zIndex=999;var obl=document.createElement('span');obbx.appendChild(obl);var obbxd=document.createElement('div');obbxd.setAttribute('id','mbd');obl.appendChild(obbxd);frag.insertBefore(obbx,obol.nextSibling);obody.insertBefore(frag,obody.firstChild);
    window.onscroll = scrollFix; window.onresize = sizeFix;}
    window.onload = initmb;
    So I am confused as Line 1 is a comment
    This same load error may occur on any of several javascript files that are loaded.
    Happens in FF 3.1.18 and 6.0

    Corrected file header
    * Modal Dialog Box
    * copyright 8th July 2006 by Stephen Chapman
    * http://javascript.about.com/
    * permission to use this Javascript on your web page is granted
    * provided that all of the code in this script (including these
    * comments) is used without any alteration
    **/

  • Error when compiling - missing return statement

    Here is a simple piece of code
    class GoodDog {
         private int size;
         public int getSize() {
              return size;
         public int setSize(int s) {
              size = s;
         void bark() {
              if (size > 60) {
                   System.out.println("Woof! Woof!");
              } else if (size > 14) {
                   System.out.println("Ruff! Ruff!");
              } else {
                   System.out.println("Yip! Yip!");
    class GoodDogTestDrive {
         public static void main (String[] args) {
              GoodDog one = new GoodDog();
              one.setSize(70);
              GoodDog two = new GoodDog();
              two.setSize(8);
              System.out.println("Dog one : " + one.getSize());
              System.out.println("Dog two : " + two.getSize());
              one.bark();
              two.bark();
    when I compile it I get following message:
    C:\java>javac GoodDogTestDrive.java
    GoodDogTestDrive.java:11: missing return statement
    ^
    1 error
    don't understand why that is?

    tsith wrote:
    BigDaddyLoveHandles wrote:
    beandocks wrote:
    well after inserting a return statement code compiles and runs. why did I need to do a return here?
         public int setSize(int s) {
              size = s;
              return size; -- added this line
         }or you could loose the return type:
    public void setSize(int s) {
    size = s;
    Rather than tighten it?No, loose, not loosen.
    [http://www.merriam-webster.com/dictionary/loose%5B2%5D]
    As in, "Archers! Loose arrows!"
    So apparently he's advising to fling ints around to breach the walls. I think he must be suffering from low blood sugar. Somebody get that man a Malomar!

  • Missing return statement - Java noob here

    Hi to everyone! I'll just like to ask if anyone of you can check out my code and see why I can do to correct this 'Missing return statement' problem with my code.
    From what I've been noticing, the compiler returns this statement when the return statements are inside conditional clauses. Usually I've been able to remedy it by storing it into another variable that's been instantiated outside my usual 'if' statements. But this time, it was my first time to use a 'try' statement since FileReader and FileWriter won't work without it. I tried to use the same remedy but it just doesn't work. Here's the part of the code I'm having problems with:
    public String[] sortWordList()
             try
                  FileReader fReader = new FileReader("initlist.txt");
                  BufferedReader bReader = new BufferedReader(fReader);
                  String output = bReader.readLine();
                  String[] words = output.split(",");
                  for(int counter1 = 0; counter1 < words.length; counter1++)
                        for(int counter2 = counter1 + 1; counter2 < words.length; counter2++)
                                  if(words[counter2].compareToIgnoreCase(words[counter1]) < 0)
                                       String temp = words[counter1];
                                       words[counter1] = words[counter2];
                                       words[counter2] = temp;
                   String temp = "";
                   for(int counter1 = 0; counter1 < words.length; counter1++)
                        FileWriter fWriter = new FileWriter("initlist.txt");
                       fWriter.write(words[counter1] + "," + temp);     
                       fWriter.close();
                       temp = bReader.readLine();
                   String output2 = bReader.readLine();
                  String[] words2 = output.split(",");
                  return words2;
             catch(IOException ioe)
        }The compiler points the 'Missing return statement' at the last bracket.
    BTW, just for those who are wonder what we're making, our teacher gave us a machine project where we have to make a basic dictionary (words only, we'll be doing the definitions and other stuff that's associated with the word some other time I think) with input and sort functions.
    Thanks guys!
    - Alphonse

    T.B.M wrote:
    By doing this, we're subverting the exception mechanism and totally defeating the purpose of exceptions. If you're going to catch an exception, you should handle it. Just smothering it and returning null is not handling it. If you're not going to handle it, then don't catch it, or else catch it and wrap it in a more layer-appropriate exception and re-throw.Then ideally there should be some *"return String[];"* statement inside "catch", not after it.No. Not unless there's some meaningful default value to use when the file can't be read, which does not appear to be the case here.
    If you return null, or an empty String[], then the caller will have to do an if test to know that something went wrong and that the method failed to do what it was supposed to do, and then what is the caller supposed to do in that case? The point of exceptions is to avoid those explicit tests for errors and let the "happy path" code just go on under the assumption that things are fine. If something goes wrong, an exception will be thrown and the happy path code will stop excuting, without having to explicitly test for an error condition.

  • Missing return statement. Why?

    Hi guys this might be an easy one for you all.
    I am receiving the error below when compiling the class below. Any idea what kind of statement I should be returning?
    Database.java:51: missing return statement
    ^
    1 error
    public Item search(String title){
         String ItemName;
         for (int i=0; i < items.length; i++)      {
             System.out.println (items);
    ItemName = items[i].getTitle(); // polymorphism
    if (ItemName.equals(title)) {
    System.out.println ("Match Exists!");
    } else {
    System.out.println ("No matches found");

    hi
    I am sorry to disturb u.this code will work fine .pls go throw the code.we have to add return statement in the two place.previously it was in loop only.Let me know the response pklease .public Item search(String title){
         String ItemName;
         for (int i=0; i < items.length; i++)      {
             System.out.println (items);
    ItemName = items[i].getTitle(); // polymorphism
    if (ItemName.equals(title)) {
    System.out.println ("Match Exists!");
    return items[i];
    } else {
    System.out.println ("No matches found");
    return null;
    return null;

  • Missing return statement?  News to me!

    Before I ask anything let be begin by saying thanks to all you people that help others on these boards, I've never posted a question before but I have often found the answers to my problems somewhere here. I'm currently working on one of my last java assignments ever and I am completely stumped as to whats going on. All I want out of this code is for it to read a txt file for a bunch of phone book entries, load them into some arrays, then sort them by first name, last name, then phone# then return the array so I can use it later on. I've got the entries loaded, I've got em sorted, but I can;t return it. When I try I get a missing return statement error. I dont know why its not returning the array, so I thought I'd ask the pros. I can get it to work fine if I dont return anything but what good is that eh?
    Please forgive my terrible coding, I am in no way a real programmer, I just want to pass my classs and never think about it again 8) any help would be appreciated. Tis is built to work with an "Entry" file, if you guys need it to proceed lemme know and I will post it. Thanks.
    the code....
        public class CSCD210PhoneBook {
           public static void main(String[] args)throws IOException
          {//Opening main          
             Scanner kb = new Scanner(System.in);
               int entryCount=0;
                   Scanner fileScanner=null;
                   Entry[] array=null;
         array=populateEntry(entryCount, fileScanner, kb);
          }//end main array=
                 public static  Entry[] populateEntry(int entryCount, Scanner fileScanner,Scanner kb)throws IOException
                    int lineCount=0;
                   String fileName;
                   File fileHandle;     
                   System.out.println("Which file would you like your entries pulled from?");
                   fileName= kb.nextLine();
                               fileHandle = new File(fileName);
                   fileScanner = new Scanner(fileHandle);
                   while(fileScanner.hasNext())
                         fileScanner.nextLine();
                         lineCount++;
                   entryCount= lineCount/8;
                   Entry[] array=new Entry[entryCount];
                   fileScanner.close();
                   fileHandle = new File(fileName);
                   fileScanner = new Scanner(fileHandle);
                        for(int i =0; i<array.length;i++)
                             array=new Entry(fileScanner);
                   fileScanner.close();
                   int curPos, indexSmallest, start;
    Entry temp;
    for (start = 0; start < array.length - 1; start++)
    indexSmallest = start;
    for (curPos = start + 1; curPos < array.length; curPos++)
    if (array[indexSmallest].compareTo(array[curPos]) > 0)
    indexSmallest = curPos;
    } // end for
    temp = array[start];
    array[start] = array[indexSmallest];
    array[indexSmallest] = temp;
                   return array;
    Any help would be most appreciated.

    The code you posted has mismatched braces: it needs another } at the end.
    Linked with this is how - or rather when - you return array from the populateEntry()
    method. You have a couple of nested for-loops and you return array inside (at the
    end of) the outer loop.
    The compiler is really fussy about making sure that an Entry[] is returned from this
    method. If you outer for-loop never gets executed for some reason, then the return
    statement will never be reached. The compiler won't accept this.
    Either
    (1) move the return statement outside both loops so it is always executed. This
    appears to be the most logical thing - but I haven't read your code that closely. It's
    just that having return at the end of a for-loop (with no "continue" in sight), doesn't
    make a lot of sense.
    or
    (2) add another return after both loops have finished.

  • UDF  missing return statement }

    Hi,
    I'm wondering how the missing return statement  error can be avoided in this code, I've tried all sorts of syntaxes but it just won't work:
    public String DetermineCostCenter(String KTOS,String KTOH,String FNR,String KST,Container container){
    int KTOHNR = 0;
    int KTOSNR  = 0;
    KTOHNR = new Integer(KTOH).intValue();
    KTOSNR = new Integer(KTOS).intValue();
    if (KTOSNR > 6999999 || KTOHNR > 6999999) {
                         if  (FNR.equals( "1"))
                                  return "1008590";
                        else if (FNR.equals("2"))
                                 return "5008090";
                        else
                                return " ";
    if (KTOSNR > 6999999 || KTOHNR > 6999999)
         return KST;
    if (KTOSNR < 3000000 && KTOHNR < 3000000)
         return " ";
    Thanks
    Tom

    Try this...
    int KTOHNR = 0;
    int KTOSNR = 0;
    String tmpktosnr = "";
    KTOHNR = new Integer(KTOH).intValue();
    KTOSNR = new Integer(KTOS).intValue();
    if (KTOSNR > 6999999 || KTOHNR > 6999999) {
    if (FNR.equals( "1"))
    tmpktosnr =  "1008590";
    else if (FNR.equals("2"))
    tmpktosnr =  "5008090";
    if (KTOSNR > 6999999 || KTOHNR > 6999999)
    tmpktosnr = KST;
    if (KTOSNR < 3000000 && KTOHNR < 3000000)
    tmpktosnr =  " ";
    return tmpktosnr;
    Hope this will help.
    Nilesh

  • Missing return statement

    Can anyone tell me why I'm getting a missing return statement error in this code?
    import java.awt.*;
    * Write a description of class Flower here.
    * @author (your name)
    * @version (a version number or a date)
    public class Flower
        protected FilledOval dot;
        protected FilledRect stem;
        protected FilledOval petal1;
        protected FilledOval petal2;
        protected static final int boundary = 100;
        protected RandomIntGenerator colorGen =
                new RandomIntGenerator(0,255);
        protected Color petalColor;
        protected Boolean flowerContains=false;
        private DrawingCanvas canvas;
        public void changeColor(Location point){
        dot = new FilledOval(point,15,15, canvas);
        dot.setColor(Color.YELLOW);
        petalColor = new Color(colorGen.nextValue(),
                                    colorGen.nextValue(),
                                    colorGen.nextValue());
        petal1.setColor(petalColor);
        petal2.setColor(petalColor);
        public void grow(Location point){
        stem = new FilledRect (dot.getX()+3, dot.getY()+10, 10, 10, canvas);
        stem.setColor(Color.GREEN);
        if (dot.getY()>boundary){
            dot.move(0,-4);
        else{
         petal1 = new FilledOval(dot.getX()-12, dot.getY()-25, 40,70,canvas);
         petal2 = new FilledOval(dot.getX()-25, dot.getY()-10, 70,40,canvas);
         dot.sendToFront();
         stem.sendToBack();
         petal1.setColor(petalColor);
         petal2.setColor(petalColor);
        public Boolean flowerContains(Location point){
            if (petal1.contains(point)){
                return true;
            else if (petal2.contains(point)){
                return true;
            else if (dot.contains(point)){
                return true;
    }

    public Boolean flowerContains(Location point){
            if (petal1.contains(point)){
                return true;
            else if (petal2.contains(point)){
                return true;
            else if (dot.contains(point)){
                return true;
        }That method returns a Boolean value. But if none of the condition gets satisfied then what is it going to return?

  • Missing return statement question

    I got a missing return statement error when i compile in this code but however i dont get any missing return statement errors in the second code that i pasted here.. What is the difference i didn't get it ? Thank you.
    public class primechecker {
        static double remainder = 0;
        public static boolean primecheck(int number){
             for(int i=2; i<number; i++){
                  remainder = number % i;
                  if (remainder == 0){
                       return false;
             if (remainder !=0){
                  return true;
        public static void main(String[] args) {
             System.out.print(primecheck(10));
    }That is the second code which gives no error.
    public class positiveornegative {
       public static boolean numbercheck (int number){
           boolean booleann = true;
           if(number > 0){
             return true;
           else if (number < 0){
             return false;
           else {
                return false;
        public static void main(String[] args) {
             System.out.println(numbercheck(-2));
    }

    In your first snippet, the compiler has no guarantee that the for loop will be executed at all. That leaves only one return inside an if condition which again it has no guarantee that it will ever be reached(the if test may fail). This leads the compiler to the conclusion that your method may never return anything at all. Yet it's definition says that it must return a value.

  • Missing Return Statement Hell!!

    public class EventSite
    private int siteNumber;
    public EventSite()
    siteNumber = 999;
    public int getSiteNumber()
    return siteNumber;
    public Void setSiteNumber(int n)
    siteNumber = n;
    I'm taking a java class and this won't compile...Whats wrong??
    Why the Missing return statement error?

    flounder wrote:
    NewProgramGirl wrote:
    no need it is now compiled, think it was the big "V'...thank you....soooo much!!Well that contradicts what you said in reply 4.I'm guessing we forgot the all important "Save" step of the development lifecycle.
    Speaking of development lifecycle my version control system at my new job consists of zipping my project to the main fileserver each night before I leave. Apparently the SVN will be set up any day now...

  • "Missing Return Statement" although the return statement IS there?

    Hello :) I am currently studying computing science at staffordshire university, java is one of my modules (first year) and im about half way through (still at introduction stage though)... Within my code apparently I have not returned a statement... yet to my believe the return statement is there and in the correct space, i would appreciate it if you could have a look and tell me where I am going wrong please:
    import java.util.*;
    public class ReadWriteArrayApp3
    +{+
    + public static void main(String [ ] args)+
    + {+
    + int[] nums = int double[6];+
    + double result;+
    + readArray(nums);+
    + printArray(nums);+
    + printReverse(nums);+
    + averageArray(nums);+
    result = averageArray(nums);
    + System.out.println("The average of your numbers is " + result);+
    + } // end main+
    public static void readArray(int [] a)
    + {+
    + Scanner kybd = new Scanner(System.in);+
    + System.out.println("Please enter 6 Integers");+
    + for(int i=0; i < a.length; i++)+
    + {+
    + a[i] = kybd.nextInt();+
    + }+
    + }+
    +public static void printArray(int [ ] b)+
    + {+
    + for (int i = 0; i < b.length; i++)+
    + {+
    + System.out.println(b);+
    + }+
    + }+
    + public static void printReverse(int [ ] c)+
    + {+
    + for (int i = c.length-1; i >= 0; i--)+
    + {+
    + System.out.println(c[i]);+
    + }+
    + }+
    + public static double averageArray(int [ ] d)+
    + {+
    + double sum, tot, average;+
    + for (int i = 0; i < d.length; i++)+
    + {+
    + tot = tot + d[i];+
    + average = (tot)/d.length;+
    + if ((average)=(tot/d.length))+
    + {+
    + sum = average;+
    +*  }
    + return sum;+
    + }+
    +} // end application class+
    Console states:
    javac  ReadWriteArrayApp3.java
    ReadWriteArrayApp3.java:49: missing return statement
    * ^*
    *1 error*
    Above in the code I have shown I have made a part bold... this shows the area in which console has a problem with.
    I would really appreciate any help in which I get
    Thankyou
    Victoria
    Edited by: StaffsUniJavaGirl on Nov 12, 2009 9:48 AM

    import java.util.*;
    public class ReadWriteArrayApp3
         public static void main(String [ ] args)
              int[] nums = int double[6];
              double result;
              readArray(nums);
              printArray(nums);     
              printReverse(nums);
              averageArray(nums);
              result = averageArray(nums);
              System.out.println("The average of your numbers is " + result);
         }  //  end main
         public static void readArray(int [] a)
              Scanner kybd = new Scanner(System.in);
              System.out.println("Please enter 6 Integers");
              for(int i=0; i < a.length; i++)
              a[i] = kybd.nextInt();
         public static void printArray(int [ ] b)
              for (int i = 0; i < b.length; i++)
                   System.out.println(b);
         public static void printReverse(int [ ] c)
              for (int i = c.length-1; i >= 0; i--)
                   System.out.println(c[i]);
         public static double averageArray(int [ ] d)
              double sum, tot, average;
              for (int i = 0; i < d.length; i++)
                   tot = tot + d[i];
                   average = (tot)/d.length;
                   if ((averagetot)=(tot/d.length))
                        sum = average;
         return sum;
    } // end application class*line 49 is bold*                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Maybe you are looking for