Search Results

Search found 1 results on 1 pages for 'gucciv12'.

Page 1/1 | 1 

  • java inheritance keyword super()

    - by gucciv12
    requirement: Given the class 'ReadOnly' with the following behavior: A (protected) integer instance variable named 'val'. A constructor that accepts an integer and assigns the value of the parameter to the instance variable 'val'. A method name 'getVal' that returns the value of 'val'. Write a subclass named 'ReadWrite' with the following additional behavior: Any necessary constructors. a method named 'setVal' that accepts an integer parameter and assigns it the the 'val' instance variable. a method 'isDirty' that returns true if the setVal method was used to override the value of the 'val' variable. Code class ReadWrite extends ReadOnly { super(int val); void setVal(int val){this.val = val;} boolean isDirty() {if (setVal()(return true)) else return false;}} More Hints: ?     You should be using: modified ?     You should be using: private ?     You should be using: public

    Read the article

1