menu
techminis

A naukri.com initiative

google-web-stories
Home

>

Technology News

>

Sealed Cla...
source image

Medium

4d

read

258

img
dot

Image Credit: Medium

Sealed Classes in Java: Deep Dive with Interview Questions

  • Sealed classes in Java provide explicit control over which classes can extend or implement a class/interface.
  • They were introduced in Java 15 (preview) and finalized in Java 17, enforcing restricted inheritance and strong encapsulation.
  • Sealed classes restrict which other classes or interfaces may extend or implement them, promoting controlled inheritance in the class hierarchy.
  • For example, in a sealed class Shape, only Circle and Rectangle are allowed to extend it.

Read Full Article

like

15 Likes

For uninterrupted reading, download the app