Category: Java core

Java – pass by reference or pass by value

Before describing how arguments are passed in java, it is worth to define how java variables are allocated inside the memory. Basically we talk about 2 types of variables: primitives and objects. Primitive variables are always stored inside the stack memory (the memory space which holds method specific variables that are short-lived, in addition to references to other objects in...

Java – Read files from classpath

In this article, we show how to read a resource file from classpath in java. 1. Add file to classpath Before reading the file, you have to add it to the classpath: If the file to be read exists under a specific folder inside the project structure, then just add the parent folder to classpath and its children will be automatically...