- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Display Minimum and Maximum values of datatype int in Java
To get the minimum value of datatype int in Java, use the following −
Integer.MIN_VALUE
To get the maximum value of datatype int in Java, use the following −
Integer.MAX_VALUE
Let us now implement this in our example.
Example
public class Demo { public static void main(String[] args) { int val1 = 20; int val2 = 3000; System.out.println("Value1: "+val1); System.out.println("Value2: "+val2); System.out.println("Maximum value: "+Integer.MIN_VALUE); System.out.println("Minimum value: "+Integer.MAX_VALUE); } }
Output
Value1: 20 Value2: 3000 Maximum value: -2147483648 Minimum value: 2147483647
- Related Articles
- Display the minimum and maximum value of primitive data types in Java
- Display the minimum of three integer values in Java
- Display the maximum of three integer values in Java
- Minimum and Maximum Priority Threads in Java
- What is the usage of ZEROFILL for INT datatype?
- How to display X-axis tick marks as minimum and maximum only without their values using plotly in R?
- How to know Maximum and Minimum values for ints in Python?
- Display the maximum amount of memory in Java
- Searching for minimum and maximum values in an Javascript Binary Search Tree
- How to find the minimum and maximum of columns values in an R data frame?
- How can I get maximum and minimum values in a single MySQL query?
- How to find the minimum and maximum values in a single MySQL Query?
- Display default initial values of DataTypes in Java
- How to read Maximum and Minimum temperature in Six's Maximum and Minimum Thermometer?
- Test whether int datatype of different sizes are not subdtypes of each other in Python

Advertisements