Java Coffee Mug
Java Coffee Mug
Photo by Michiel Leunens on Unsplash

Variables in Java can be categorized into instance, static & local. In programming, it is always advisable to only declare and initialize a variable right before it’s usage. If a value to initialize couldn’t be identified, the need of the variable should be re-evaluated. This is to avoid unnecessary memory usage and enhance code readability because of the reduced scope. In Java, out of these 3 variables, only one is required to be initialized before it’s usage or else compiler would throw an error. In other words, local variables don’t have default values. …


When it comes to Java in calling a method and passing arguments as primitives, there’s no doubt that it follows the pass by value model. Trouble in understanding comes when dealing with Objects. Since reference types store the address of the object, when reference types are passed as arguments, it’s the memory address of the object that is passed and any change to the object’s nature (instance variables) inside the called method reflects in the caller.

This raises the question, Does Java pass by reference when it comes to reference types?

Image for post
Image for post
Photo by Nathan Dumlao on Unsplash

Variables

Before getting into the discussion of pass by value/reference, let’s understand about the kind of variables apart from the standard variable that were available to programmers in the languages that predate Java. …


Image for post
Image for post
Photo by Alina Grubnyak on Unsplash

I stumbled upon a mention of Rich Hickey’s rant on Hammock Driven Development on a medium article and decided to go ahead with it to see what it’s about. The ideas were really good, very simple and practical that every developer could follow. When searching more on the topic and the ideas that he expressed, I came across a free MOOC on Coursera titled “Learning How to Learn: Powerful mental tools to help you master tough subjects” with a duration of a month.

Intrigued by the title, I decided to give it a go to see what the idea is all about. After all, we all want to master tough subjects. To be honest, my expectations weren’t that high though the course had a 4.8-star rating. And I wasn’t sure whether I would be able to finish it at all. Because I procrastinate a lot and I was afraid that the enthusiasm that I’ve about the course on week one would vanish away even before I reach week two. …


Image for post
Image for post
Photo by Peter Nguyen on Unsplash

The addition of lambda expressions paved the way for a new operator in the Java operator library. It’s the lambda operator (or arrow operator).

Lambda operator — > which means "goes to" or “becomes”

A lambda expression can be segregated into two parts, left side parameter list, and right side expression logic with lambda operator dividing them. There can also lambda expressions without any parameter(s). In those cases, empty parenthesis must be included on the left side and the right side representing the processing logic involved. Below is an example of an empty parameter lambda expression,

1. () -> 3.14

It means the expression takes no parameter and it returns a double value. …


Image for post
Image for post
Photo by Nick Karvounis on Unsplash

Functional Programming is the talk of the town in 2019 with a lot of languages and many tech giants either making one or supporting it widely. Scala, Clojure, Haskell, F#, Elixir are the most prominent ones. But they aren’t on the meteoric rise of the charts without a reason. They come up with a vast array of features that the traditional ones didn’t in the beginning or right out of the box. Like parallel programming, immutable data usage, lazy evaluation to name a few. Of all the advantages, the ones that Java borrowed and incorporated into its own skillset were lambdas and streams. …

About

Vivek T S

Applications Developer 2 @ Oracle

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store