Every java developer must have used these basic methods in Java

FullStackTips
4 min readJan 7, 2023
some frequently used basic methods in Java (image from educba)

If you are a java developer, you must have used most of them already in your project!

There are many methods that are frequently used in Java, and the specific ones that are used most often can depend on your project needs. Here are a few examples of common methods and conversions that are used in Java.

  1. Object.toString(): This method is used to convert an object to a string representation. It is often overridden in custom classes to provide a meaningful string representation of the object.
Person p = new Person("John", 30);
System.out.println(p.toString());

2. parseInt(): This method is used to convert a string to an integer. It is a part of the Integer class and can be used as follows.

int x = Integer.parseInt("123");

3. valueOf(): This method is used to convert a primitive data type (such as int or double) to an object of the corresponding wrapper class (such as Integer or Double). It can be used as follows:

Integer y = Integer.valueOf(123); // y is an Integer object with the value 123
Double e = Double.valueOf(3.12); // e is a Double object with the value 3.12
Long l= Long.valueOf(123434); // l is a Long object with the value 123434
Boolean b = Boolean.valueOf(true); // b is a…

--

--

FullStackTips

I am full stack developer with over 15 years of experience in various programming languages. https://medium.com/@fullstacktips/membership