Initialization blocks in Java classes

February 24, 2016 Java 5 comments

Initialization block Java

Initialization blocks in Java allow you to initialize your instance variables using more complex statements. In this article,  I teach how to use non-static and static initialization blocks in Java classes. (more…)

Methods with variable amounts of arguments in Java

February 23, 2016 Java 4 comments

Java tutorial

Learn how to create Java methods with variable amount of arguments. (more…)

Default initialization of instance variables in Java

February 22, 2016 Java 4 comments

Java tutorial

In Java, if you don’t set instance variables yourself, they will be set into their default values. For numeric types it will be 0 (or 0.0 for floating-point types), boolean will be set to false and objects to null reference. Read this article to learn more about this mechanism. (more…)

Copying and converting arrays (including ArrayList) in Java

February 21, 2016 Java 1 comment

Copying and converting array and ArrayList in Java

Copying arrays is a simple operation, but must be done with caution. Doing it improperly may cause copying reference instead of actual array which may lead to a serious trouble. In this article I am explaining how to copy Java arrays the right and safe way. Additionally, I will explain how to easily convert array to ArrayList and opposite – ArrayList to array. (more…)

Default methods in Java interfaces

February 20, 2016 Java 3 comments

Java 8 default methods in interfaces

Java 8 implemented a new type of method into interfaces, called default methods. Default methods in Java interfaces allow to create methods with body, which classes can either choose to inherit or extend. In this article, I am explaining how to use default methods in Java interfaces. (more…)

Calling constructors from other constructors in Java

February 16, 2016 Java 1 comment

Java calling one constructor from another

Very often we write multiple constructors to make a possibility to create objects with different initial state. Those constructors very often in large part do the same thing. Instead of rewriting the same code in every constructor, we can call one constructor from another. In this article I explain how to do this. (more…)

fail2ban SSH on Ubuntu/Debian/Mint

February 15, 2016 Systems Administration 2 comments ,

fail2ban ubuntu debian mint

Is your Ubuntu or Debian server experiencing brute-force attacks on SSH? In this article I am explaining how to secure your server against SSH attacks with fail2ban on Ubuntu and its derivatives (like Mint), as well as on Debian.

If you are looking for instruction for CentOS, see my other post.

fail2ban is a special software that is installed on a server to block intruders’ IP addresses after exceeding configured amount of failed login attempts. (more…)

fail2ban SSH on CentOS

February 15, 2016 Systems Administration 4 comments ,

fail2ban centos

Various malicious bots or human-attackers may be trying to get access to your server over SSH. In this article I will explain how to secure your server against SSH brute-force attacks with fail2ban on CentOS.

If you are looking for instructions for Ubuntu, Debian or Linux Mint, see my other post.

fail2ban is a special software that is installed on a server to block intruders’ IP addresses after exceeding configured amount of failed login attempts. (more…)

Is Java pass by value or reference?

February 14, 2016 Java 20 comments

Does Java pass by value or by reference?

In this article I will answer the long asked question by beginners, “is Java pass by value or reference?“. (more…)

Reading user input in Java

February 14, 2016 Java 4 comments

java reading user input

In this article I will shorty explain a few techniques how to read user input in Java. (more…)