Solved

error in code

Posted on 2002-05-07
1
164 Views
Last Modified: 2011-10-03
when i try to compile this code i get an error on this line saying that

Method void add(int, String, String, int) requires a method body. Otherwise declare it as abstract.

          public void add(int Position,String DocumentName,String Owner,int Size);

can someone please help?

the code to the whole program is below

separate class

class QueueNode
{

     public int Position;
     public String DocumentName;
     public String Owner;
     public int Size;
     
     public QueueNode next;
     public QueueNode previous;
     
}



import uuInOut;
class Queue extends QueueNode
{
     QueueNode start;
     QueueNode end;

     
          public Queue()
          {
               start = new QueueNode();
               start = null;
               end = new QueueNode();
               end = null;
          }
         
         
          public void add(int Position,String DocumentName,String Owner,int Size);
          {
               if (start ==null)
               {
                    start=new QueueNode();
                    start.Position = uuInOut.ReadInt();
                    start.DcoumentName = uuInOut.ReadString();
                    start.Owner = uuInOut.ReadString();
                    start.Size = uuInOut.ReadInt();
                    start.next = null;
                    start.previous = null;
                    end = start;
               }
               else
               {
                    QueueNode temp = new QueueNode();
                    temp.Position = uuInOut.ReadInt();
                    temp.DocumentName = uuInOut.ReadString();
                    temp.Owner = uuInOut.ReadString();
                    temp.Size = uuInOut.ReadInt();
                    temp.next = end;
                    end.previous = temp;
                    end = temp;
               }
          }
         
          public boolean isEmpty()
          {
               return (start ==null);
          }
         
          public int remove()
          {
               QueueNode temp = new QueueNode();
               if (start ==null)
                    return -1;
               
               else if (start.previous ==null)
               {
               temp = start;
               start = null;
               return temp.Position;
               return temp.DocumentName;
               return temp.Owner;
               return temp.Size;
               }
               else
               {
               temp = start;
               start = start.previous;
               return temp.Position;
               return temp.DocumentName;
               return temp.Owner;
               return temp.Size;
               }
          }
         
          public void displayAll()
          {
               QueueNode temp = new QueueNode();
               
               temp = start;
               while (temp !=null)
               {
                    System.out.println(temp.Position);
                    System.out.println(temp.DocumentName);
                    System.out.println(temp.Owner);
                    System.out.println(temp.Size);
                    temp = temp.previous;
               }
          }    
}


thanks for any help!!!

0
Comment
Question by:penfold69
1 Comment
 
LVL 18

Accepted Solution

by:
bobbit31 earned 50 total points
ID: 6994730
public void add(int Position,String DocumentName,String Owner,int Size);

get rid of the semicolon

public void add(int Position,String DocumentName,String Owner,int Size)

0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question