Avatar of gudii9
gudii9
Flag for United States of America asked on

default methods vs abstract class

Hi,

I was reading below link

http://www.java2blog.com/2014/06/interface-default-methods-in-java-8.html

I have not understood below point relating to state

Parameter
Abstract class
Interface with default methods
State of objects
Abstract class can hold state of object
Interface with default methods can not hold state of objects

Read more at http://www.java2blog.com/2014/06/interface-default-methods-in-java-8.html#vEL23vv16DICqYjs.99

what is state of object?
How it one can hold and other cannot hold?

Also what it mean by overriding method to solve compilation error as below
you can solve this compilation error by overriding decorateWithPaints method in Room class
view plainprint?
public class Room implements Decorable,Paintable{  
 
    public void decorateWithPaints()  
    {        
        System.out.println("Decorate using paints");    
  }  
}

Read more at http://www.java2blog.com/2014/06/interface-default-methods-in-java-8.html#4dayfCwCZs3KPu77.99

please advise
JavaJava EEProgrammingWeb ServersJSP

Avatar of undefined
Last Comment
CPColin

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
CPColin

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes