Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: added import statement

...

Code Block
bgColor#FFcccc
class Vector {
private int val = 1;
  public boolean isEmpty() {
    if(val == 1)   //compares with 1 instead of 0
      return true;
    else
      return false;
  }
  //other functionality is same as java.util.Vector
}

import java.util.Vector;

public class VectorUser {
  public static void main(String[] args) {
    Vector v = new Vector();
    if(v.isEmpty())
      System.out.println("Vector is empty");
  }
}

...