devxlogo

Classes

create a training video

How to Create Training Videos Easily: 5-Step Guide

The American Society for Training and Development surveyed 2,500 companies and found that companies that have a comprehensive training guide, including e-learning and videos, have a 218% higher revenue and

Call a Private Constructor

Calling a private constructor from outside its class can be done via Reflection as follows: public final class Users { private Users() {} // static members}Class usersClass = Users.class;Constructor emptyUsersCnstr

Employing the Formatter Class in Java

The Formatter class is used to format the output as needed. Here, we are trying to print the current time formatted in more than one format. Please see the output

Merge Two Dictionaries in Python

The Dictionary class in Python provide an update() function that allows you to merge two dictionaries. For example: employeeScore = { ‘Emp1’:100, ‘Emp2’:98, ‘Emp3’:96}employee2019Score= { ‘Emp1’:101, ‘Emp2’:104} To merge, just

Usage of the Repository Factory Class

Spring Data provide a class named RepositoryFactorySupport. Via this class we can access any repository, as in the following example: RepositoryFactorySupport factory = … // code that instantiate the factory;CustomerRepository

Get the UTC Machine Time in Java

Beginning with JDK 8, the machine UTC timestamp with nanoseconds precision can be obtained via the java.time.Instant class as below: // e.g., 2019-02-26T15:28:21.051163100ZInstant now = Instant.now();

Expore the TemporalAdjusters Class in Java

TemporalAdjusters is a class in Java that is oriented towards bettering the options of Calendar. You can easily compute the dates of firstDayOfNextMonth, lastDayOfMonth, next Wednesday, etc. TemporalAdjusters have many more methods

Avoid Poor Use of Reflection

Class beanClass = ???If (beanClass.newInstance() instanceof TestBean) ??? The above code is tries to use the reflection API, it tries to find a way to check for inheritance, but it