Use app×
QUIZARD
QUIZARD
JEE MAIN 2026 Crash Course
NEET 2026 Crash Course
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
0 votes
307 views
in JAVA by (178k points)
How do you get the maximum and minimum values of a Wrapper Class in Java?

Please log in or register to answer this question.

1 Answer

0 votes
by (178k points)

You can get the maximum and minimum values of a wrapper class in Java by using the MAX_VALUE and MIN_VALUE constants provided by the wrapper class.

For example, to get the maximum and minimum values of the Integer class, you can use the following code:

int maxInt = Integer.MAX_VALUE;
int minInt = Integer.MIN_VALUE;

System.out.println("Max value of Integer = " + maxInt);
System.out.println("Min value of Integer = " + minInt);
 

This code will print out the maximum and minimum values of the int primitive type, which are represented by the MAX_VALUE and MIN_VALUE constants of the Integer class.

Similarly, you can get the maximum and minimum values of other wrapper classes such as Double, Long, Float, etc. by using their respective MAX_VALUE and MIN_VALUE constants.

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

Categories

...