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.

Similar Messages

  • 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" 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

  • Missing Return Statement, where do I put it?

    Hi am using some code from the Sun website, it is called the KnockKnockProtocol, and I have edited it a bit and I get a "missing return statement" error. When I put one in the server does not run at all?
    import java.net.*;
    import java.io.*;
    public class KnockKnockProtocol {
        private static final int WAITING = 0;
        private static final int SENTKNOCKKNOCK = 1;
        private static final int SENTFILE = 2;
        private static final int ANOTHER = 3;
        private static final int NUMJOKES = 5;
        private int state = WAITING;
        private int resource = 0;
        private String[] file = {"1. iTune 2. ZoneAlarm 3. WinRar 4. Audacity (Select a resource for downloading)"};
        private String[] download1 = {"You are downloading iTune.zip."};
        private String[] download2 = {"You are downloading ZoneAlarm.zip."};
        private String[] download3 = {"You are downloading WinRar.zip."};
        private String[] download4 = {"You are downloading Audacity.zip."};
        public String processInput(String theInput) {
            String theOutput = null;
            if (state == WAITING) {
                theOutput = "Here are the terms of reference. Do you accept?";
                state = SENTKNOCKKNOCK;
            } else if (state == SENTKNOCKKNOCK) {
                if (theInput.equalsIgnoreCase("Yes")) {
                    theOutput = file[resource];
                    state = SENTFILE;
                } else {
                    theOutput = "Please accept the terms of reference to continue. Do you accept?";
            } else if (state == SENTFILE) {
                if (theInput.equalsIgnoreCase("1")) {
                    theOutput = download1[resource] + " Do you want to download another?";
                    state = ANOTHER;
                } else if (state == SENTFILE) {
                    if (theInput.equalsIgnoreCase("2")) {
                        theOutput = download2[resource] + " Do you want to download another?";
                        state = ANOTHER;
                    } else if (state == SENTFILE) {
                        if (theInput.equalsIgnoreCase("3")) {
                            theOutput = download3[resource] + " Do you want to download another?";
                            state = ANOTHER;
                        } else if (state == SENTFILE) {
                            if (theInput.equalsIgnoreCase("4")) {
                                theOutput = download4[resource] + " Do you want to download another?";
                                state = ANOTHER;
                        } else {
                            theOutput = "You're supposed to select \"" +
                                    file[resource] +
                                    "\"" +
                                    " Please try again!";
                            state = SENTKNOCKKNOCK;
                    } else if (state == ANOTHER) {
                        if (theInput.equalsIgnoreCase("Yes")) {
                            theOutput = file[resource];
                        if (resource == (NUMJOKES - 1)) {
                            resource = 0;
                        } else {
                            resource++;
                        state = SENTKNOCKKNOCK;
                    } else {
                        theOutput = "Bye.";
                        state = WAITING;
                return theOutput;
    }Any ideas how to solve would be nice. Thanks.

    private String[] file = {"1. iTune 2. ZoneAlarm 3. WinRar 4. Audacity (Select a resource for downloading)"};
        private String[] download1 = {"You are downloading iTune.zip."};
        private String[] download2 = {"You are downloading ZoneAlarm.zip."};
        private String[] download3 = {"You are downloading WinRar.zip."};
        private String[] download4 = {"You are downloading Audacity.zip."};<nitpick>
    Do you understand what arrays are for?
    </nitpick>

  • Missing Return Statement - Please Help

    I get the "missing return statement" in line 47 in the getNumber method when I try to compile. Any suggestions?
    import java.util.Scanner; //imports scanner
    import java.util.Random;  //imports class Random
    public class Guess {
        Random randomNumbers = new Random();
        int answer;
        int userGuess;
        public void newGame()
            int answer = getNumber();
        public void play()
           Scanner input = new Scanner( System.in ); //creates scanner input
           System.out.println("\n\n Guess a number between 1 and 1000 or just" +
                   "press 0 to exit:" );
           userGuess = input.nextInt();
           while (userGuess != 0);
               checkUserGuess();
               System.out.println("Please enter another guess:");
               userGuess = input.nextInt();
        public int getNumber()
           int answer = 1 + randomNumbers.nextInt( 1000 );
        }  //ERROR IS DISPLAYED HERE
        /** Creates a new instance of Guess */
        public void checkUserGuess()
            if ( userGuess >= answer)
                System.out.println("Your guess is too high, try again");
            else
                if ( userGuess <= answer)
                    System.out.println("Your guess is too low, try again");
                else
                    System.out.println("Congratulation, you guessed correctly");
    }

    The error message says it all.
    You declared your getNumber method as returning integer.
    However you didnt return any number.
    add the reutrn statement to the method
    return answerJust to add, you have declared answer as global
    variable and agian answer as local variable.
    You are messing up a little there.
    Message was edited by:
    lupansansei

  • 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.

  • 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 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*                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • 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;

  • 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

  • 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

  • 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

  • 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.

Maybe you are looking for

  • Partner  VN is not picking in sales order pricing

    Hi My client requirement is system has to calculate commission amount depend on the combination of sold to party and commission agent(created as vendor). I defined one condition type by adding access sequence in that access sequence i have maintained

  • Tool bar in Mail

    Is there a way to get the paperclip icon that then takes you to the dialog box to open, save, etc.,  attachments  to be located in the toolbar?  It appears - and disappears - along with some other action buttons - as you scroll over the dividing line

  • Counter Strike Source lags a lott

    My System: Athlon XP 2000 (oced to 2600) Geforce 6800 128mb (Aperture set to 256mb) 1GB of RAM Many games (quake 4, doom 3) run pretty good in linux (not as good as windows tho :-).. but CSS laggs reallly bad (never above 30fps and playing with like

  • Modal Popup Window close issue

    Hi, i have a master detail form i added a link field on detail form to open a form in popup modal mode i putted on Link Attributes onClick="new Ext.ux.PopupWindow({url: this.href, height: 450}).show(); return false;" due Modal Popup Window example by

  • Sony Camcorder and an ibook G4 - a love/hate relationship?

    Hi, I'm new to using a Mac and i'm keen to edit our summer videos, shot using a Sony Handycam DCR-HC18E. I don't think it's compatible -so what do i have to do? Is it worth keeping the Handycam or do i launch it up the Garden? Hope you can help