Explain the difference between an abstract class and an interface in Java, particularly regarding memory and inheritance.