“Resumo vs final” Respostas de código

Resumo vs final

1-Abstract method should be overriden
 -Final method can't be overriden
2-Abstract method can be inherited
 -Final can't be inherited
3-Abstract can be w/o implementation
 -Final must have implemetation
4-Abstract we can't create objects
 -Final we can create objects(string)
5-Abstract can't be instantiated
 -Final can be instantiated
Obedient Ocelot

Resumo vs final


public final class MyClass { //final not required but clearly states intention
    //private default constructor ==> can't be instantiated
    //side effect: class is final because it can't be subclassed:
    //super() can't be called from subclasses
    private MyClass() {
        throw new AssertionError()
    }

    //...
    public static void doSomething() {}
}

Crowded Caterpillar

Respostas semelhantes a “Resumo vs final”

Perguntas semelhantes a “Resumo vs final”

Mais respostas relacionadas para “Resumo vs final” em Java

Procure respostas de código populares por idioma

Procurar outros idiomas de código