21.04.23 Aufgabe 1+2

master
j 2023-04-21 15:27:08 +02:00
parent f10f988806
commit 50086f4274
1 changed files with 15 additions and 7 deletions

View File

@ -40,9 +40,13 @@ public class ArrayExperimente
*/ */
public static boolean istEnthalten(int gesucht, int[] array) public static boolean istEnthalten(int gesucht, int[] array)
{ {
// TODO... for(int i=0; i<array.length; i++)
{
// das return steht hier nur, damit der Compiler nicht meckert: if (array[i] == gesucht)
{
return true;
}
}
return false; return false;
} }
@ -55,10 +59,14 @@ public class ArrayExperimente
*/ */
public static int indexVon(int gesucht, int[] array) public static int indexVon(int gesucht, int[] array)
{ {
// TODO... for(int i=0; i<array.length; i++)
{
// das return steht hier nur, damit der Compiler nicht meckert: if (array[i] == gesucht)
return -3245646; {
return i;
}
}
return -1;
} }