Bizzare Java invalid Assignment Operator Error
        Posted  
        
            by Kay
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Kay
        
        
        
        Published on 2010-04-15T17:00:02Z
        Indexed on 
            2010/04/15
            17:03 UTC
        
        
        Read the original article
        Hit count: 235
        
    public class MaxHeap<T extends Comparable<T>> implements Heap<T>{
 private T[] heap;
 private int lastIndex;
 private static final int defaultInitialCapacity = 25;
 public void add(T newItem) throws HeapException{
  if (lastIndex < Max_Heap){
   heap[lastIndex] = newItem;
   int place = lastIndex;
   int parent = (place – 1)/2; //ERROR HERE**********
   while ( (parent >=0) && (heap[place].compareTo(heap[parent])>0)){
    T temp = heap[place];
    heap[place] = heap[parent];
    heap[parent] = temp;
    place = parent;
    parent = (place-1)/2;
  }else {
   throw new HeapException(“HeapException: Heap full”); }
  }
 }
Eclipse complains that there is a:
"Syntax error on token "Invalid Character", invalid AssignmentOperator"
With the red line beneath the '(place-1)'
There shouldn't be an error at all since it's just straight-forward arithmetic. Or is it not that simple?
© Stack Overflow or respective owner