Click here to Skip to main content
15,887,746 members
Home / Discussions / Java
   

Java

 
AnswerRe: help Pin
Richard Deeming22-Mar-16 3:01
mveRichard Deeming22-Mar-16 3:01 
QuestionHow to handle 404 page not found exception in Spring MVC with java configuration and no Web.xml Pin
glassShot10015-Mar-16 6:13
glassShot10015-Mar-16 6:13 
Questionhow do i fix this array out of bound index Pin
divinity0215-Mar-16 0:21
divinity0215-Mar-16 0:21 
AnswerRe: how do i fix this array out of bound index Pin
Richard MacCutchan15-Mar-16 2:40
mveRichard MacCutchan15-Mar-16 2:40 
GeneralRe: how do i fix this array out of bound index Pin
divinity0215-Mar-16 9:28
divinity0215-Mar-16 9:28 
GeneralRe: how do i fix this array out of bound index Pin
Richard MacCutchan15-Mar-16 10:37
mveRichard MacCutchan15-Mar-16 10:37 
GeneralRe: how do i fix this array out of bound index Pin
divinity0215-Mar-16 21:46
divinity0215-Mar-16 21:46 
AnswerRe: how do i fix this array out of bound index Pin
Patrice T16-Mar-16 16:26
mvePatrice T16-Mar-16 16:26 
A simplified version of your code. And this version don't fail if largest value is the first one.
Java
smallest = arr[0];
largest = arr[0];
for(i=1; i<=arr.length; i++)
{
    if(arr[i] < smallest)
    {
         smallest = arr[i];
    }
    else if(arr[i]> largest)
    {
        largest = arr[i];
    }
}
System.out.println("the smallest number is "+smallest);
System.out.println("the largest number is "+ largest);

Patrice

“Everything should be made as simple as possible, but no simpler.” Albert Einstein

GeneralRe: how do i fix this array out of bound index Pin
divinity0217-Mar-16 9:51
divinity0217-Mar-16 9:51 
QuestionNew To Java Pin
aahamdan13-Mar-16 4:15
aahamdan13-Mar-16 4:15 
AnswerRe: New To Java Pin
Richard MacCutchan13-Mar-16 7:13
mveRichard MacCutchan13-Mar-16 7:13 
Questionjava Pin
Member 1238766612-Mar-16 8:14
Member 1238766612-Mar-16 8:14 
AnswerRe: java Pin
Richard MacCutchan13-Mar-16 0:10
mveRichard MacCutchan13-Mar-16 0:10 
QuestionUsing recursion Pin
Member 1238223510-Mar-16 18:42
Member 1238223510-Mar-16 18:42 
AnswerRe: Using recursion Pin
Richard MacCutchan10-Mar-16 21:25
mveRichard MacCutchan10-Mar-16 21:25 
GeneralRe: Using recursion Pin
Member 1238223510-Mar-16 22:15
Member 1238223510-Mar-16 22:15 
GeneralRe: Using recursion Pin
Richard MacCutchan11-Mar-16 2:36
mveRichard MacCutchan11-Mar-16 2:36 
AnswerRe: Using recursion Pin
Patrice T16-Mar-16 15:26
mvePatrice T16-Mar-16 15:26 
QuestionDoubt regarding Java coding Pin
Sweacha Nlakshmi10-Mar-16 18:16
Sweacha Nlakshmi10-Mar-16 18:16 
GeneralRe: Doubt regarding Java coding Pin
Richard MacCutchan10-Mar-16 21:24
mveRichard MacCutchan10-Mar-16 21:24 
Questioncoffee shop management system in java Pin
Hussain Anwer6-Mar-16 2:52
Hussain Anwer6-Mar-16 2:52 
AnswerRe: coffee shop management system in java Pin
Richard MacCutchan6-Mar-16 4:20
mveRichard MacCutchan6-Mar-16 4:20 
QuestionCustom Browser Pin
sandeep kamara26-Feb-16 18:06
sandeep kamara26-Feb-16 18:06 
AnswerRe: Custom Browser Pin
Richard MacCutchan26-Feb-16 21:57
mveRichard MacCutchan26-Feb-16 21:57 
Questioncore java (Singleton pattern ) Pin
Hiren Akbari25-Feb-16 6:45
professionalHiren Akbari25-Feb-16 6:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.