difference Between integer.paseInt () and Integer.valueOf()
Answers
Integer.parseInt():
While operating upon strings, there are times when we need to convert a number represented as a string into an integer type. The method generally used to convert String to Integer in Java is parseInt(). This method belongs to Integer class in java.lang package. It takes a valid string as a parameter and parses it into primitive data type int. It only accepts String as a parameter and on passing values of any other data type, it produces an error due to incompatible types.
Integer.valueOf():
This method is a static method belonging to the java.lang package which returns the relevant Integer Object holding the value of the argument passed. This method can take an integer or a String as a parameter. But when the given String is invalid, it provides an error. This method can also take in a character as a parameter but the output will be its corresponding Unicode value. This method will always cache values in the range -128 to 127, inclusive, and may cache other values outside of this range.
please mark as brainlist answer and follow me please thank answer ☺️☺️☺️☺️☺️
Answer:
valueOf() returns an Integer object while Integer. parseInt() returns a primitive int. Both String and integer can be passed a parameter to Integer. valueOf() whereas only a String can be passed as parameter to Integer.
Explanation:
MARK ME AS BRAINLIEST