0

Can any One help me , find the error in my program please. It is Saying that :::::: Exception in thread "main" java.lang.Array

public class Program{ public static void main(String[] args ){ String[] customersNames = { "K","Krishna","Prasad" }; int[] customersSavings = {100,200,300}; int allCustomersSavings = 0; for(int x = 0; x<=customersSavings.length;x++){ allCustomersSavings += customersSavings[x]; } System.out.println("***** Krishna Bank *****"); System.out.println("Total Number Of Customers in The Bank : "+customersNames.length); System.out.println("Savings Of All Customers"+allCustomersSavings); System.out.println("Customer 1 : "+customersNames[0]); System.out.println("Customer 1 Savings : "+customersSavings[0]); System.out.println("Customer 2 : "+customersNames[1]); System.out.println("Customer 1 Savings : "+customersSavings[1]); System.out.println("Customer 3 : "+customersNames[2]); System.out.println("Customer 1 Savings : "+customersSavings[2]); } }

19th Feb 2019, 12:51 PM
Krishna Prasad
Krishna Prasad - avatar
1 ответ
0
The Solution is in the condition of forLoop remove equal
19th Feb 2019, 1:06 PM
Krishna Prasad
Krishna Prasad - avatar