class BreakEx
{
public static void main(String[] ahmed)
{
//Declaring array
int[] numbers = {10, 20, 40, 30, 50};
//Declaring 'x' as integer and assigning 'numbers' to x
for(int x : numbers)
{
if(x==30)
{
break;
}
System.out.println(x);
System.out.println("\n");
}
}
}
{
public static void main(String[] ahmed)
{
//Declaring array
int[] numbers = {10, 20, 40, 30, 50};
//Declaring 'x' as integer and assigning 'numbers' to x
for(int x : numbers)
{
if(x==30)
{
break;
}
System.out.println(x);
System.out.println("\n");
}
}
}
Dear User,
Thank you for your comment. Hope you like this blog. Kindly share us on Social Media so others can be updated.
-Chief Administrative Officer.
Note: only a member of this blog may post a comment.