First, note that String and Integer are both immutable. Is t…

First, note that String and Integer are both immutable. Is the class below mutable or immutable? If mutable: a) provide client code that will mutate it; and b) provide an immutable version of it (your solution has to be minimal, i.e., make the minimal changes possible, or you might loose points). If immutable, provide a convincing argument why it is so.     class SomeClass {     public String string;     public Integer n;         public SomeClass(String string, int n) {         this.string = string;                             this.n = n;                                   }       public String getString() { return string; }      public Integer getInt()    { return n; }       }  

Is the class below mutable or immutable? If mutable: a) prov…

Is the class below mutable or immutable? If mutable: a) provide client code that will mutate it; and b) provide an immutable version of it (your solution has to be minimal, i.e., make the minimal changes possible, or you might loose points). If immutable, provide a convincing argument why it is so.   class SomeClass {     public char arr) {         this.arr = arr;                                                     }     public char [] getArray() { return arr; }  }

Is the class below mutable or immutable? If mutable: a) prov…

Is the class below mutable or immutable? If mutable: a) provide client code that will mutate it; and b) provide an immutable version of it (your solution has to be minimal, i.e., make the minimal changes possible, or you might loose points). If immutable, provide a convincing argument why it is so.   class SomeClass {     public char arr) {         this.arr = arr;                                                     }     public char [] getArray() { return arr; }  }

The function below is meant to return the first index i at w…

The function below is meant to return the first index i at which a == b. E.g. firstDuplicate(, ) = 1. Given the precondition: ((a != null)&&(b != null)). Provide the postcondition   public static int firstDuplicate(int b)    // Precondition:      ((a != null)&&(b != null))    // Postcondition:             

The function below is meant to return the first index i at w…

The function below is meant to return the first index i at which a == b. E.g. firstDuplicate(, ) = 1. Provide a specification such that: 1) The precondition is very strong. 2) The postcondition cannot throw any exceptions or return any integer that indicates that a duplicate does not exist.   public static int firstDuplicate(int b)    // Precondition:                          // Postcondition:           

The function below is meant to return the first index i at w…

The function below is meant to return the first index i at which a == b. E.g. firstDuplicate(, ) = 1. Provide a specification such that: 1) The precondition is very strong. 2) The postcondition cannot throw any exceptions or return any integer that indicates that a duplicate does not exist.   public static int firstDuplicate(int b)    // Precondition:                          // Postcondition: