Tuesday, April 17, 2018

Why the java.lang.System neither abstract nor instantiable

It’s to prevent you from making a subclass that can be instantiated. In Java:

* an abstract class cannot be instantiated, but its subclasses can be

* a final class cannot be subclassed

* a class cannot be both final and abstract

The System class has a private constructor to prevent you from instantiating it (this is good practice for “utility classes”), and it is final to prevent you from getting around that by creating a subclass that has a usable constructor. And because it is final, it cannot be abstract

Regards: https://www.quora.com/Why-isn-t-the-Java-lang-system-class-in-Java-an-abstract-when-it-cannot-be-instantiated/answer/Jon-Harley?share=782923fd&srid=h5t7z

2 comments:





  1. Men looking for Call Girl in Surat usually have a variety of needs that need to be fulfilled. Some want to hire escorts just as a companion, some want them to be their dinner dates or dance floor partners while others may want them to play the role of the sexy girlfriends. Check our other services also..
    Female Escorts in Agra
    Female Escorts in Agra
    Female Escorts in Agra
    Female Escorts in Agra
    Female Escorts in Agra

    ReplyDelete
  2. The development of unique artwork arose during the forties in New York. It bit by bit picked up significance in American workmanship. At the point when craftsmen like James McNiell started having confidence in the agreeable plan of tones in speaking to visual sensation instead of the portrayal of articles, deliberation began picking up unmistakable quality. custom painting by numbers

    ReplyDelete