Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.


+13 votes
asked in CSC211_Winter2018 by (1 point)

2 Answers

+12 votes

Integer.MAX_VALUE is the largest integer that can be stored in an int memory location. That value is Integer.MAX_VALUE = 2147483647.

In case you are worndering, Integer.MIN_VALUE = - 2147483648.

answered by (1 point)
+11 votes

An example from our notes in using MAX_VALUE is:

int min = Integer.MAX_VALUE;
for (int count = 0; count < numScores; count++){
System.out.print(“Enter score: );
int currentScore = console.nextInt();
if (currentScore < min){
min = currentScore;

This was used to find the minimum value. You can set an int variable equal to MAX_VALUE and then use that int variable you set to MAX_VALUE to compare it.

answered by (1 point)