Comment

jhay^^,
How?,
June 27, 2008 at 6:54 PM

i tried this program on my jcreator i edited the code, i made it like this:

class MatrixSum
{
public static void main(String[] args)
{
int array[][]= {{1,3,2},{5,3,4},{3,4,5}};
int array1[][]= {{4,3,6},{5,6,2},{3,5,4}};


System.out.println("Number of Row= " + array.length);
System.out.println("Number of Column= " + array[1].length);
int l= array.length;
System.out.println("Matrix 1 : ");
for(int i = 0; i < l; i++) {
for(int j = 0; j <= l; j++) {
System.out.print(" "+ array[i][j]);
}
System.out.println();
}
int m= array1.length;
System.out.println("Matrix 2 : ");
for(int i = 0; i < m; i++) {
for(int j = 0; j <= m; j++) {
System.out.print(" "+array1[i][j]);
}
System.out.println();
}
System.out.println("Addition of both matrix : ");
for(int i = 0; i < m; i++) {
for(int j = 0; j <= m; j++) {
System.out.print(" "+(array[i][j]+array1[i][j]));
}
System.out.println();
}
}
}


In the lines 5 and 6 i added more numbers, and then compiled it, theres no error, but wen i run the prog this is the result:

----------------Configuration:
<Default>--------------------
Number of Row= 3
Number of Column= 3
Matrix 1 :
1 3 2Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 3
at MatrixSum.main(matrix sum.java:15)

Process completed.



what was my error? please reply asap....
i need to learn...
View All Comments
Advertisement
Related Tutorial and Articles
Java Beginners

java - Java Beginners
 

Java Interview Questions

Beginners in Java
 

Java Beginners

java beginners - Java Beginners
 

Java Beginners

Java for beginners
 

Java Beginners

java beginners doubt!
 

Java Beginners

programming - Java Beginners
 

Java Beginners

Java for beginners - Java Beginners
 

Java Beginners

Good tutorials for beginners in Java
 

Java Beginners

Java - Java Beginners
 

Java Beginners

beginners questions
 

Java Beginners

basic java - Java Beginners
 

Java Beginners

java - Java Beginners
 

Java Beginners

java - Java Beginners
 

Java Beginners

java - Java Beginners
 

Java Beginners

Tutorial For Java beginners
 

Java Beginners

java downloads - Java Beginners
 

Java Beginners

java - Java Beginners
 

Java Beginners

java beginners - Java Beginners
 

Java Beginners

Program - Java Beginners
 

Java Beginners

java beginners - Java Beginners
 

Java Beginners

java beginners - Java Beginners
 

Java Beginners

java beginners - Java Beginners
 

Java Beginners

Java basics - Java Beginners
 

Java Beginners

java beginners - Java Beginners
 

Java Beginners

java beginners - Java Beginners
 

Java Beginners

java beginners - Java Beginners
 

Java Beginners

java beginners - Java Beginners
 

Java Beginners

java beginners - Java Beginners
 

Java Beginners

java beginners - Java Beginners
 

Java Beginners

java beginners - Java Beginners
 

Java Beginners

java beginners - Java Beginners
 

Java Beginners

Queue - Java Beginners
 

Java Beginners

Java - Java Beginners
 

Java Beginners

Java programming for beginners video tutorials
 

Java Beginners

java beginners - Java Beginners
 

Java Beginners

java beginners - Java Beginners
 

Java Beginners

java compilation error - Java Beginners
 

Java Beginners

java beginners - Java Beginners
 

Java Beginners

java - Java Beginners
 

Java Beginners

java beginners - Java Beginners
 

Java Beginners

matrices - Java Beginners
 

Java Beginners

array - Java Beginners
 

Java Beginners

programmes - Java Beginners
 

Java Beginners

java - Java Beginners
 

Java Beginners

Static method in java - Java Beginners
 

Java Beginners

help - Java Beginners
 

Java Beginners

Java programming - Java Beginners
 

Java Beginners

java - Java Beginners
 

Java Beginners

stringbuffer - Java Beginners
 

Java Beginners

java - Java Beginners
 

Java Beginners

java related - Java Beginners
 

Java Beginners

java programming problem - Java Beginners
 

Java Beginners

program - Java Beginners
 

Java Beginners

examples - Java Beginners
 

Java Beginners

small java project - Java Beginners
 

Java Beginners

small java project - Java Beginners
 

Java Beginners

Casting in java - Java Beginners
 

Java Beginners

java sorting codes - Java Beginners
 

Java Beginners

java - Java Beginners
 

Java Beginners

String in Java - Java Beginners
 

Java Beginners

Java Syntax - Java Beginners
 

Java Beginners

java code - Java Beginners
 

Java Beginners

Java - Java Beginners
 

Java Beginners

javaprograms - Java Beginners
 

Java Beginners

programming error - Java Beginners
 

Java Beginners

java - Java Beginners
 

Java Beginners

java - Java Beginners
 

Java Beginners

java - Java Beginners
 

Java Beginners

java - Java Beginners
 

Java Beginners

java - Java Beginners
 

Java Beginners

Object in java - Java Beginners
 

Java Beginners

java"oop" - Java Beginners
 

Java Beginners

guidance for the beginners - Java Beginners
 

Java Beginners

java - Java Beginners
 

Java Beginners

Java Program - Java Beginners
 

Java Beginners

explanation - Java Beginners
 

Java Beginners

java program - Java Beginners
 

Java Beginners

java - Java Beginners
 

Java Beginners

a java program - Java Beginners
 

Java Beginners

programs - Java Beginners
 

Java Beginners

java - Java Beginners
 

Java Beginners

hi - Java Beginners
 

Java Beginners

Java basics - Java Beginners
 

Java Beginners

Java - Java Beginners
 

Java Beginners

leap year logic - Java Beginners
 

Java Beginners

merge sorting in arrays - Java Beginners
 

Java Beginners

java type casting problem - Java Beginners
 

Java-Tutorials

Java projects for beginners
 

Java Beginners

java-io - Java Beginners
 

Java Beginners

Java Syntax - Java Beginners
 

Java Beginners

Java Fundamentals - Java Beginners
 

Java Beginners

J2EE - Java Beginners
 

Java Beginners

writing aprogram - Java Beginners
 

Java Beginners

java - Java Beginners
 

Java Beginners

java - Java Beginners
 

Java Beginners

jav beginners - Java Beginners
 

Java Beginners

java - Java Beginners
 

Java Beginners

java beginners
 

Java Beginners

java+cts - Java Beginners
 

Java Beginners

java+cts - Java Beginners
 

Advertisements Advertisements
 

 

 

DMCA.com