Modifying JAR files without rebuilding the JAR
===

I have a JAR file that I'm using and I want to modify one of the files inside it. In a nutshell I have

    public class ClassB {
        public void printMethod(){
           ClassA A = new ClassA();
           A.printout();
        }	
    }

    public class ClassA {
      public void printout(){
        System.out.println("1234");
      }
    }

and I want to change ClassA's printout method to
   
    public class ClassA {
      public void printout(){
        System.out.println("abcd");
      }
    }

I know you cannot modify a JAR without unpacking/rebuilding it and for this, let's say I can't do that. Is there a way to make modifications to ClassA without actually touching the current ClassA? My approach is to have a new class inherit from ClassA with an overridden method and then have a new class inherit from ClassB that calls the Inherited ClassA

    public class InheritedClassA extends ClassA{
      @Override
      public void printout(){
        System.out.println("abcd");
      }
    }

    public class InheritedClassB extends ClassB{
      @Override
      public void printMethod(){
        InheritedClassA A = new InheritedClassA();
        A.printout();
      }
    }

I don't like this approach though because in my actual JAR, so many classes are using ClassA that its a nightmare trying to correctly do this with all of them, which then all require the same process on them.  I know you cannot overload/overwrite a whole class which is basically what I want to do. Is there another way to do this?