Question: How do I fix this error? Exception in thread main java.lang.ArrayIndexOutOfBoundsException: 7 at refrigerator.Refrigerator.main(Refrigerator.java:280) /Users/home/Library/Caches/NetBeans/8.2/executor-snippets/run.xml:53: Java returned: 1 BUILD FAILED (total time: 15 seconds) if(line.charAt
How do I fix this error?
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 7 at refrigerator.Refrigerator.main(Refrigerator.java:280) /Users/home/Library/Caches/NetBeans/8.2/executor-snippets/run.xml:53: Java returned: 1 BUILD FAILED (total time: 15 seconds)

if(line.charAt (0)'C') 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 try int num1- Integer.parseInt(line.charAt (2)+""); int num2- Integer.parseInt(line.charAt (4)+""); int resultRef Integer.parseInt(line.charAt (6)+""); int[] ref1 -listRefs [num11.get(); int[l ref2 listRefs [num2].get(); int [] combined- listRefs[resultRef].combine (ref1, ref2); listRefs[resultRef].set (combined); output = "Refrigerators #"+num1+" and #" +num2+" were combined into refrigerator #"+resultRef; catch (NumberFormatException e) System.out.println ("NumberFormatException has occured")
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
