Substring Based on a Character in Java

String class provides us with powerful String processing methods, out of those, substring is one. In this example, we’ll look into examples on substring based on a given character in Java. Unfortunately, String class doesn’t provide us with an out of box substring method to get a substring based on a character, however you can … Read more

Private Final Variable in Java

A variable which is declared as private is not accessible outside of the class. That means you cannot access that private variable using a reference variable after instantiating the class. You can also declare a variable as private final in Java, then not only it will be accessible outside of the class, you will not … Read more

Integer methods getInteger vs parseInt vs valueOf with Examples

Integer class has three methods called as getInteger, parseInt and valueOf. Each of these methods solve a specific purpose. In this post, we’ll discuss the differences between them with examples. On a high-level below are the differences between these 3 methods. getInteger parseInt valueOf It determines the integer value of a given system property It … Read more

Solving Int Cannot Be Dereferenced in Java

If you are getting “int cannot be dereferenced” error in Java, it means that you are attempting to call a method or an attribute on a int type value. You should note that int is a primitive type and its variables do not store reference, they contain the actual value, so you cannot dereference using … Read more