Few questions on over riding.

I am interiting a method openRead from another class, the method is to be overridden so that the scanner class uses the provided delimiter pattern, which is referenced. I need to make use of the scanner method.

method from another class

public boolean openRead() throws FileNotFoundException
 {
   sc = new Scanner(new File(fileName));
   
    if (fileName != null)
    {
         return true;
    }
    else
    {
        return false;
    }
  
}

delimiter

protected final String DELIMITERS = "[\\s[^'a-zA-Z]]";

I'm at a loss to how i over ride this using the constant delimiter.

Also
If i have a method which is to override another method but extend it, do i use for example update.super() and then write the code i want to extend it with?

You can just overload a method
You will have first to extends the class then you can overload the method

class MyClass extends theClassThatContainsOpenRead {

   // now you can overload
   public boolean openRead() throws.... {
     // your code here
     // if filename and sc are private you will have to use the getter/setter for
     // them or you just can't overload
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.