Results 1 to 2 of 2
  1. #1
    ai_2007 is offline Member
    Join Date
    Jun 2007
    Posts
    21
    Rep Power
    0

    Default Problems with method

    I have creation a class InformationProcess1 with the method below :

    Java Code:
    public InformationProcess1(String instance) {
          this.jiffiesUserMode = 0;
          this.percentageUserProcess = 0;
          this.jiffiesSystemMode = 0;
          this.percentageSystemProcess = 0;
          this.virtualMemorySize = 0;
          this.residentMemorySize = 0;
          this.meterThreads = 0;
          this.percentageCPUProcess = 0;
          this.instance = instance;
       }
    But when compiled, an error message pops up saying :

    Invalid method declaration. Return type required.

    Why is this and how do I resolve it?

  2. #2
    JavaBean's Avatar
    JavaBean is offline Moderator
    Join Date
    May 2007
    Posts
    1,270
    Rep Power
    9

    Default

    Hi,

    The message is clear. You forgot to write the return type of the method or you write the constructor name wrongly. Check the class name again if this is a constructor. If this is a method, then you need to add return type at the beginning of method declaration.

Similar Threads

  1. Problems passing a scan object to a method
    By xkross in forum New To Java
    Replies: 4
    Last Post: 04-16-2008, 03:56 PM
  2. problems to find the main method
    By christina in forum Eclipse
    Replies: 2
    Last Post: 08-06-2007, 07:51 PM
  3. problems with replace method
    By cecily in forum New To Java
    Replies: 1
    Last Post: 08-02-2007, 09:11 PM
  4. BufferedReader: readLine method problems
    By bbq in forum Advanced Java
    Replies: 2
    Last Post: 06-30-2007, 02:27 AM
  5. Problems with Find method in EJB
    By Nick15 in forum Enterprise JavaBeans (EJB)
    Replies: 0
    Last Post: 05-14-2007, 01:29 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •