एक 2 डी ऐरे का प्रोग्राम लिखिए।
Answers
Answered by
0
2D array का program
Explanation:
एक 2D array का program दो तरह से लिख सकते है|(in java language)
पहला तरीका :
class Two_dimension
{
public static void main(String args[])
{
Int[][] x={{23,56,78},{68,98,35}};
System.out.println(“Two dimensional array”);
Systems.out.println(a[0][0]);
System.out.println(a[0][1]);
System.out.println(a[1][0]);
System.out.println(a[1][1]);
}
}
दूसरा तरीका :(using for loop)
class Two_dimension
{
public static void main(String args[])
{
Int[][] x={{23,56,78},{68,98,35}};
System.out.println(“Two dimensional array”);
for(int i=0;i<3;i++)
{
for(int j=0;j<3;j++)
{
Systems.out.println(a[i][j]);
}//end of 2nd loop
}//end of 1st loop
}//end of main
}//end of class
Similar questions