Solved

error in code

Posted on 2002-05-07
1
166 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
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…

707 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