“Resumen vs final” Código de respuesta

Resumen 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

Resumen 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

Respuestas similares a “Resumen vs final”

Preguntas similares a “Resumen vs final”

Más respuestas relacionadas con “Resumen vs final” en Java

Explore las respuestas de código populares por idioma

Explorar otros lenguajes de código