Category: Java

java tutorials

Initialization of an ArrayList in one line example

This tutorials demonstrates how to initialize a list or arraylist in one line in different ways. The traditional way to create and initialize an ArrayList is: List<String> planets = new ArrayList<String>(); planets.add(“Earth”); planets.add(“Mars”); planets.add(“Venus”);...
java tutorials

How to Calculate Folder Size in Java

Calculating the size of a folder or directory is trivial. In Java you can recursively traverse each folder and calculate the size of each file individually, and return the sum of all the files....
java tutorials

Converting a String into a Date in Java

This tutorial shows how to convert a java.lang.String into a java.util.Date. We can convert a String into a Date using the parse() method of the DateFormat and SimpleDateFormat classes. // from java.lang.String into java.util.Date...
java tutorials

Getting Current Date and Time in Java

This tutorial shows how to get the current date and time in Java. The standard Java classes we can use are java.util.Date, java.util.Calendar and the new java 8 java.time.LocalDateTime and java.time.ZonedDateTime. You could also...
tomcat tutorials

Monitor Tomcat with JMX and jConsole

This tutorial shows how to monitor Tomcat with JMX via jConsole. Monitoring is a key aspect for developers or system administrators. Looking inside a running server, obtaining some statistics like: Heap / Non-heap memory...