Category Archives: Java 8

Metaspace in Java8

Metaspace in Java8One of the new features that we will see in Java8 is the introduction of Metaspace. Metaspace is nothing but a replacement of our old friend PermGen (Permanent Generation) space.

What is PermGen?
The permanent Generation is part of your heap space that is actually used to store meta-data information for the classes created by users and prior to Java 7, it is also used to store interned Strings (interned strings – used to remove String duplicates by internalizing them to reduce memory consumption). As of Java 7, intern strings also moved as a part of heap space to make the more space available in Continue reading Metaspace in Java8

Default Methods in Java 8 Explained – Part 2 (A comic way)

If you have missed out the first part of this story i.e Default Methods in Java 8 ,you can read it here , else you can read the recap of first part here.

Recap : Interface IRoleService (i.e project manager) decided to assign extra duties to all (developer,tester ,ba etc) who are working on the project by introducing a new method extraDuties() in its interface. After this introduction of new extra duties  , TesterServiceImpl (i.e Tester of the application) rebelled and clear that he won’t perform any extra duties.When senior manager came to know about this situation , he advised interface IRoleService to introduce default methods so that no body will be forced to provide an implementation for extraDuties().

Now before going ahead let’s look at the code how default methods will be invoked and what Continue reading Default Methods in Java 8 Explained – Part 2 (A comic way)

Default Methods in Java 8 Explained – Part 1 (A comic way)

Default methods in Java 8 or we can also call them defender methods is one of the new feature that you will see in Java 8.  I would rather say it is one of the most awaited feature should have been introduced in the earlier versions itself.Anyways its never been late so that it can’t be used , I think finally its a great introduction by Oracle Java Team.

Now as we know in Java (prior to 8) all the implementation classes (non abstract) of an interface have to agree the interface contract and under that contract they have to provide the concrete implementations of all the methods available in interface that they are implementing , if you missed in providing implementation for even a single method ,compiler will start complaining about it.

Now consider a scenario you want to have a method in your interface and you don’t want to Continue reading Default Methods in Java 8 Explained – Part 1 (A comic way)

Share and Enjoy

  • Facebook
  • Twitter
  • Delicious
  • LinkedIn
  • StumbleUpon
  • Add to favorites
  • Email
  • RSS