Categories
Java

Invoking private method and accessing private fields using Java reflection

In general we can not access private field and method via object in Java. But using reflection we can do in normal standalone application. But In applications like applet or android application it requires special permission to access private fields and methods. Table of content Invoking private methods Accessing private fields Here is  sample private […]

Categories
Java

Java Serialization using Serializable Interface

Example of Java Serialization and De-Serialization using Serializable interface and ObjectOutputStream class. Complete serialization and deserialization information when you do via Serializable interface.

Categories
Java

Generate Public/Private Key Pair in Java

Java example to generate public/private key pairs using KeyPairGenerator class.

Categories
Java

De-serializing JSON String Using Jackson ObjectMapper

Example of JSON string de-seriazing into Java object using jackson library.

Categories
Java

Best ways to redirect page using JavaScript

Best way to redirecting or navigating to another page using JavaScript.

Categories
Java

How to get current user name using Java

Java example to get current user name on windows OS.

Categories
Java

Java DateTime extension class

Java class to extend java.util.Date class to add some methods given in c# like addSeconds, addMinutes, addDays, addYears etc. This are really helpful.

Categories
Java

Class to calculate differences in two dates

Java example for calculating difference between two date in different units. You can use this utility class in you java program.