Solved

error in code

Posted on 2002-05-07
1
160 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
Comment Utility
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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

772 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now