How to delete an element from an array in java?

Поделиться
HTML-код
  • Опубликовано: 17 окт 2024

Комментарии • 17

  • @rachamallidorasrivignesh4499
    @rachamallidorasrivignesh4499 4 месяца назад +1

    Thank you so much for great explanation.

  • @LinyueWeng
    @LinyueWeng 3 месяца назад

    what if there are more than 1 element of which you want to remove in the array? (i.e. {1, 2, 3, 3, 4} with element being 3)

  • @maestradolouiegerard7881
    @maestradolouiegerard7881 5 месяцев назад

    What IDE do you use?

    • @bandiraghu
      @bandiraghu 5 месяцев назад

      I think it is Eclipse IDE

    • @nyashas7608
      @nyashas7608 2 дня назад

      Yes.. it's eclipse

  • @shivarajyadachi1842
    @shivarajyadachi1842 Год назад

    sir, please catch the AIOB execption in case element not found

    • @ShubhamPatil-rl4jk
      @ShubhamPatil-rl4jk 8 месяцев назад

      you must have not used same name in the method signature?

  • @samahmahdi5511
    @samahmahdi5511 7 месяцев назад

    Thank you

  • @prajwalkande5879
    @prajwalkande5879 9 месяцев назад +7

    Little bit easier one!!
    public static void main(String[] args) {
    Scanner sc=new Scanner(System.in);

    int a[ ]= {1,2,3,4,5,2};
    System.out.println("enter element to be deleted:-");
    int b= sc.nextInt();

    for(int i=0;i

  • @malayapanda9040
    @malayapanda9040 7 месяцев назад

    Dynamic code likhiye naa..

  • @sainath2983
    @sainath2983 5 месяцев назад +1

    public class Program
    {
    static void Main(string[] args)
    {
    int[] nums = { 1, 2,3,4,5,6,7,8,9,10 };
    int x = 3;
    List list = new List();
    for(int i = 0; i < nums.Length; i++)
    {
    if(x != nums[i])
    {
    list.Add(nums[i]);
    }
    }
    foreach(int i in list)
    {
    Console.WriteLine(i);
    }
    }
    }

  • @aigulidrisova1126
    @aigulidrisova1126 Год назад

    👍

  • @bhaveerathod2373
    @bhaveerathod2373 6 месяцев назад

    YOU SAVED ME BRO OMG I WISH I SAW THIS 10 MINUTES AGO BEFORE MY DUE DATE
    thank you so so soooooo much i subscribed because of this 🥹🥹🥹🥹👏👏
    I'm still so sad because it's 12 am and my mind isn't working properly if i thought to search this up earlier in stead of trouble shooting I could have submitted my assignment before the deadline.
    The only thing I struggled with was not adding the "index" variable like you did, so i kept getting out of bounds error. And i had so much time that I wasted so now it's late, but better late than never i guess

  • @Anitha.D
    @Anitha.D 10 месяцев назад

    Thank you