6 Replies Latest reply: Sep 28, 2012 7:38 AM by notivago RSS

    SOME MOST PROBALE ERROR IN MOST JAVA CODE

    964137
      hi...
      Otn team..

      i want to know while i am running some program in netBeans it shows some error ...
      1)class interface or enum expected.

      2)illegal Start of type.

      3)if i use super keyword to add some argument within it than it shows an error that
      "Keyword super should be used at the start of method constructr"

      4)Method does not override or implement method from a supertype

      5)Class SalaryEmploy is public and should be declared in a file names SalaryEmploy..


      can any one please help what are these error and why they comes??
        • 1. Re: SOME MOST PROBALE ERROR IN MOST JAVA CODE
          gimbal2
          Born2Program wrote:
          hi...
          Otn team..
          There is no OTN team, just us visitors, the same as you.

          The answer to all questions is exactly the same: the code is not according to the java specifications. If you are really "born to program", I would go look at the code and figure out what is wrong with it. Might be as simple as a missing semicolon ( ; )


          PS: I would stick to the New To Java subforum if I were you.
          • 2. Re: SOME MOST PROBALE ERROR IN MOST JAVA CODE
            Tolls
            Born2Program wrote:
            hi...
            Otn team..

            i want to know while i am running some program in netBeans it shows some error ...
            1)class interface or enum expected.

            2)illegal Start of type.

            3)if i use super keyword to add some argument within it than it shows an error that
            "Keyword super should be used at the start of method constructr"

            4)Method does not override or implement method from a supertype

            5)Class SalaryEmploy is public and should be declared in a file names SalaryEmploy..


            can any one please help what are these error and why they comes??
            1 and 2 are probably due to your code structure being incorrect, eg mismatched brackets, missing ';', that sort of thing.
            3 could be due to the above, or you really are using 'super' in the wrong place.
            4 and 5 are self-explanatory.
            • 3. Re: SOME MOST PROBALE ERROR IN MOST JAVA CODE
              aksarben
              If these are questions from a take-home test, you're on your own. No one will do homework for you.

              On the other hand, if you're seeing these errors when you run your code, post the actual code & stack trace.
              • 4. Re: SOME MOST PROBALE ERROR IN MOST JAVA CODE
                939520
                When you have a very small project and multiple errors, you might consider redoing the project from scratch and adding one thing at a time, making sure it compiles, before adding another item. I don't know about Netbeans (never used it), but Eclipse IDE often shows you where the problem is and sometimes offers suggestions to fix it.

                Also, from the nature of your questions, I think it would be a good idea to take a few hours to read a book on Java from cover to cover if you haven't already done so, rather than spend those hours guessing and not getting anywhere.
                • 5. Re: SOME MOST PROBALE ERROR IN MOST JAVA CODE
                  notivago
                  This are very, very basic errors, if you are having such problems you have not studied the bare minimum about java language:
                  http://docs.oracle.com/javase/tutorial/getStarted/cupojava/netbeans.html
                  • 6. Re: SOME MOST PROBALE ERROR IN MOST JAVA CODE
                    notivago
                    1 - In
                    import java.util.Date;
                    
                    public class Caos {
                      ...
                    }
                    You most likely forgot the 'class' keyword.

                    2 - It is very likely you have unbalanced '{' somewhere in your code.

                    3 - The super keyword is meant to invoke constructors on the super class, and this should happen before your own construction code ever happen, java language defines that the default super constructor is invoked if you do nothing to invoke it and if you invoke it you must do that as the very first thing in your constructor.

                    4 - You are marking something with @override which does not override anything, or just implements an interface method if you are using java 5.

                    5 - By definition, every public class should be declared on its own file and the file have to have the same name as the class, so class SalaryEmploy shouold be in SalaryEmploy.java