Java Homework Help | Help with Java Programming | Programming Homework Help | Java Programming Assignment Help | Help with Java Programming Assignment | Java Tutor | Programming Help | Java Online Help | Java Programming Online | Java Programming Projects

Multidimentional Array is very important in java programming. It plays vital role in help with java programming. Students of java programming faces lots of problems in understanding the concept of Multi Dimensional Arrays and its implimentation in coding in object orined programming. To help students following is the example of multidimensional array with explanation :-

Multidimensional arrays are actually arrays of arrays.

Syntax to create two dimensional Array
dataType arrayName[][] = new dataType[size1][size2]
(OR)
dataType[][] arrayName;

arrayName = new dataType[size1][size2]

for Example consider the array of size 5*4.
int arr[][] = new int[5][4];

00 01 02 03
10 11 12 13
20 21 22 23
30 31 32 33
40 41 42 42

Table 1 : Array indexes
100 553 512 -9
12 32 43 56
1 3 5 7
9 -87 -98 0
-12 46 78 97

Table 2 : Values stored in Array
When you compare table1 and table 2

arr[0][0] = 100
arr[0][1] = 553
arr[0][2] = 512
arr[0][3] = -9

Example
class ArrayEx{
public static void main(String args[]){
int arr[][] = new int[5][4];

arr[0][0] = 100;
arr[0][1] = 553;
arr[0][2] = 512;
arr[0][3] = -9;

arr[1][0] = 12;
arr[1][1] = 32;
arr[1][2] = 43;
arr[1][3] = 56;

arr[2][0] = 1;
arr[2][1] = 3;
arr[2][2] = 5;
arr[2][3] = 7;

arr[3][0] = 9;
arr[3][1] = -87;
arr[3][2] = -98;
arr[3][3] = 0;

arr[4][0] = -12;
arr[4][1] = 46;
arr[4][2] = 78;
arr[4][3] = 97;

/*Display Elements */
for(int i=0; i<5; i++){
for(int j=0; j<4; j++){
System.out.print(arr[i][j] +"\t");
}
System.out.println();
}
}
}

Output
100 553 512 -9
12 32 43 56
1 3 5 7
9 -87 -98 0
-12 46 78 97

In java comments also play important role to understand the functionalitiy of program . This explains how the program or function works .

Comments in java, makes the program more readable.

Suppose you written thousand lines of program, with out proper documentation, after some time, for the owner of the application also, it is very difficult to figure out what was written.

Comments solve this problem :
By using comments, you can document your code at the time of writing program. Comments won't affect your program execution. Comments simply document your code.

Java supports 3 types of comments

Single line comment :
Single line comments starts with //
// It is a single line comment

Multi Line comment
Multi line comments are encoded in /* */
/* I am a mulltiline comment */

Documentation comments
javadoc tool uses doc comments when preparing automatically generated documentation.

/**
* Java doc comments
*/

Example
/**
* Author : Krishna
* Date : 5th Feb 2014
*/
class CommentsEx{
public static void main(String args[]){
int marks; /* variable marks represents the marks
obtained by a student */
marks = 70;
System.out.println(marks); //printing to console
}
}

Output
70

Notable points

1. Giving more comments also makes your program not readable, use whenever needed.

2. Use meaning full names to variables like noOfMonths. avgSalary etc., these reduce to comment them explicitly

3. Use meaning full names to methods like sortAscend, sortDescend, searchElement etc., these reduce to comment them explicitly

Our Team

We have 2500+ expert pool from all over the world. They are highly qualified and well experienced. All experts have experinced in teaching and good command over programming topics. Some of our experts are as follows:


John Doe

JAVA EXPERT(10+ Yrs Exp.)

Larry Doe

C EXPERT(12+ Yrs Exp.)

Ranith Kays

C++ EXPERT(8+ Yrs Exp.)

Joan Ray

OPEN SOURCE LANGUAGE EXPERT(8+ Yrs Exp.)