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

Fix java.lang.UnsupportedClassVersionError in Eclipse

Usually people who’ve installed Eclipse newly receive this error. Let us understand the meaning of this Error. This error gets thrown when JVM tries to run a class file and finds that the JRE version is not within the min and max versions mentioned in the class file. But why this happens? It could be … 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

Using Access Modifiers with Constructor in Java

In Java, we have 4 access modifiers that we can apply to a member variable and methods. But, how about Constructors? How these access modifiers can be used with constructors in Java? Let us see. We can very well use access modifiers with constructors in Java. These access modifiers work just the way they work … Read more