Update Test_3.java

This commit is contained in:
Mandeep Moun
2025-10-28 23:08:54 -06:00
committed by GitHub
parent 41395648e3
commit 5357afb682

View File

@@ -1,5 +1,5 @@
public class Test_3{
public int search(int [][] matrix, int to_search){
public boolean search(int [][] matrix, int to_search){
for(int i = 0; i < matrix.lenght; i++){
for(int j = 0; j < matrix[i].legth; j++) {
if (matrix[i][j] == to_search){
@@ -9,9 +9,14 @@ public class Test_3{
}
return false;
boolean result = this.contains(new int[][] {
public static void main(String[] args){
Test_3 ojb = new Test_3();
int[][] data = new int[][] {
{1,2,3},
{22,42,45},
{38,26,16}}, 42);
}
};
boolean result = obj.search(data, 420;
System.out.println("Found: " + result);