Java

Convert Milliseconds into Years, Months, Weeks, Days, Hours, Minutes, Seconds in Java

Introduction This example shows you how to convert milliseconds into years, months, weeks, days, hours, minutes, seconds in Java. Sometimes we need to convert the milliseconds into years or months or weeks or days or hours or minutes or seconds. For example, when you want to check the exact time taken by a program to […]

Packaging war, jar modules into ear

Introduction Here we will see the process of packaging war, jar modules into ear file. EAR, aka, Enterprise Archive, in which all files (.jar and .war) are packaged as JAR file with .ear (enterprise archive) extension and deployed into Application Server. WAR, JAR and EAR EJB modules which contain enterprise java beans (class files) and […]

Understanding Memory Management in Java

Memory management is the process of allocating objects and removing the unused objects so that memory can be allocated for new objects. Heap and Nursery Heap is created when JVM starts up and may increase or decrease in size during application runtime. Java objects reside in the heap area. Garbage collection is run when heap […]

Understanding Run-Time Data Areas in Java Vitual Machine

The Java Virtual Machine (JVM) defines various run-time data areas that are used during execution of a program. Some of these data areas are created on Java Virtual Machine start-up and are destroyed only when the Java Virtual Machine exits. Other data areas are per thread. Per-thread data areas are created when a thread is […]

Java Vitual Machine

Java Virtual Machine also known as JVM, is a cornerstone of Java platform. It is important platform to execute your Java applications. The first prototype implementation of JVM was created at Sun Microsystems. It was emulated in software hosted by a handled device called Personal Digital Assistant(PDA). Oracle’s current implementations emulate the JVM on mobile, […]

How to create HTTP server in Java to serve static resources

Here I will show you how to create HTTP server in Java to serve static resources using sun’s HttpServer. An HTTP Server is bound to an IP address and port number and listens for incoming requests and returns responses to clients. Simple http server is flexible to be added into complex projects for rendering HTML elements […]

Composition vs Aggregation explained with Java

Composition vs Aggregation explained with Java will show you what is Composition and what is Aggregation? In simple terms, both Composition and Aggregation are Associations. Composition means “Strong Has-A relationship”, whereas, Aggregation means “Weak Has-A relationship”. Composition implies a relationship where the child cannot exist independently without the parent. Example: House (parent) and Room (child). Room doesn’t […]

Segregate positive followed by negative elements in an Array

This example will show you how to segregate positive followed by negative elements in an Array using Java programming language. The function will put all positive numbers first, and then negative numbers and finally count the number of moves required to arrange all elements in the desired order. Prerequisite Knowledge of Java Let’s move on […]

Convert Milliseconds into Days, Hours, Minutes, Seconds in Java

Introduction This example shows you hot to convert milliseconds into days, hours, minutes, seconds in Java. Sometimes we need to convert the milliseconds into days or hours or minutes or seconds. Typically when you want to check the exact time taken to execute a program then you may need to calculate the time. So in […]

Scroll to top