Solved

error in code

Posted on 2002-05-07
1
165 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Facing this issue for maven proxy setting 2 44
sql import cannot be resolved jsp 3 115
Java basic valueOf question 1 50
Java Inheritance super keyword use 8 71
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues undeā€¦
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ā€¦
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
This video teaches viewers about errors in exception handling.

734 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