Remember that array indexes start at 0. So, for an array with five locations, the indexes would be 0,1,2,3,4. Check that FOR loops and the results of any calculated indexes take this into account. Also, make sure that a value is checked before it is incremented.String[] bob = new String[10]; for(int i=1 ; i<10 ; i++) The index should start at 0, and go to 9 { bob[i]="bob" The error will point to this line }In the first program, the error is caused by the FOR loop having the wrong parameters. This causes the error in another place. |
Asynchronous Communication Advantages: Requests need not be targeted to specific server. Service need not be available when request is made. No blocking, so resources could be freed. Could use connectionless protocol Disadvantages: Response times are unpredictable. Error handling usually more complex. Usually requires connection-oriented protocol. Harder to design apps Synchronous Communication Advantages: Easy to program Outcome is known immediately Error recovery easier (usually) Better real-time response (usually) Disadvantages: Service must be up and ready. Requestor blocks, held resources are “tied up”. Usually requires connection-oriented protocol
Comments
Post a Comment