title: incompatible return type using multiple classes
body: <p>Im writing a program to simulate simple queues of Process Control Blocks and having an issue with a return value in my returnPcb() method. I am getting an "invalid return type".  I know the return type in my method is a Pcb, but I cannot change it.  I want to return the value of -1 if the the call to removePcb() is false.  My thought was to create a new Pcb, set a value to -1, and return that value.  This is where I am running into issues.  I need help returning -1 when the condition is false. Thank you.  </p>
  
  <p>MasterQueue Class:</p>
  
  <pre><code>import java.util.*;
  
  public class MasterQueue {
  
      HashMap&lt;String,Queue&lt;Pcb&gt;&gt;hash;
  
      MasterQueue(){
          hash = new HashMap&lt;&gt;();
      }
  
      public boolean addQueue(String nameIn){
          String QueueName = nameIn;
          if(hash.containsKey(QueueName)){
              return false;
          }
          //else add new queue the hashmap
          else{
              Queue&lt;Pcb&gt; q = new LinkedList&lt;&gt;();
              hash.put(QueueName,q);
              return true;
          }
      }
  
      public boolean addPcb(Pcb p,String nameIn){
          String PcbName = nameIn;
          //if queue exist in the list then add the pcb to it
          if(hash.containsKey(PcbName)){
              hash.get(PcbName).add(p);
              return true;
          }
          //else return false
          else{
              return false;
          }
      }
  
      public Pcb removePcb(String nameIn){
          String RemovePcbName = nameIn;
          //if this queue exist in the list then remove first element from the queue
          if(hash.containsKey(RemovePcbName)){
              return hash.get(RemovePcbName).remove();
          }
          Pcb p = new Pcb(0, 0, 0, -1);
          return p.getPid();
      }
  
  }
  </code></pre>
  
  <p>PCB Class:</p>
  
  <pre><code>public class Pcb {
  
  
  private int low;
  private int high;
  private int state;
  int pid;
  
  Pcb(int lowMemIn, int highMemIn, int stateIn, int pidIn){
      setLowMem(lowMemIn);
      setHighMem(highMemIn);
      setState(stateIn);
      setPid(pidIn);
  }
  
  public void setLowMem(int lowMemIn){
      low = lowMemIn;
  }
  
  public int getLowMem(){
      return low;
  }
  
  public void setHighMem(int highMemIn) {
      high = highMemIn;
  }
  
  public int getHighMem(){
      return high;
  }
  
  public void setState(int stateIn){
      state = stateIn;
  }
  
  public int getState() {
      return state;
  }
  
  public void setPid(int pidIn){
      pid = pidIn;
  }
  
  public int getPid(){
      return pid;
  }
  }
  </code></pre>
  
  <p>Test</p>
  
  <pre><code>@Test
  public void testAddPcb1() {
      Pcb pid1 = new Pcb(1, 2, 3, 4);
      MasterQueue mq1 = new MasterQueue();
      mq1.addQueue("miniQueueStr");
  
      Assert.assertTrue("error", mq1.addPcb(pid1, "miniQueueStr"));
  </code></pre>