Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

java take inpt into arraylist

// Java program to demonstrate the 
// working of ArrayList in Java 
  
import java.io.*; 
import java.util.*; 
  
class ArrayListExample { 
    public static void main(String[] args) 
    { 
        // Size of the 
        // ArrayList 
        int n = 5; 
  
        // Declaring the ArrayList with 
        // initial size n 
        ArrayList<Integer> arrli 
            = new ArrayList<Integer>(n); 
  
        // Appending new elements at 
        // the end of the list 
        for (int i = 1; i <= n; i++) 
            arrli.add(i); 
  
        // Printing elements 
        System.out.println(arrli); 
  
        // Remove element at index 3 
        arrli.remove(3); 
  
        // Displaying the ArrayList 
        // after deletion 
        System.out.println(arrli); 
  
        // Printing elements one by one 
        for (int i = 0; i < arrli.size(); i++) 
            System.out.print(arrli.get(i) + " "); 
    } 
}
Comment

PREVIOUS NEXT
Code Example
Java :: remove activity from recent list android 
Java :: x squared unicode java code 
Java :: edit data from database sqlite android 
Java :: light black border android 
Java :: how to find all apps on android device using java 
Java :: capitalize a letter in java 
Java :: how to do two constructors with super 
Java :: how to add 0 in left padding using regular expression java 
Java :: java webelement how to double click 
Java :: how to make a string alphabetic 
Java :: run app by package android 
Java :: spring-boot java header Content-Type constant 
Java :: manifest merger 
Java :: zebra zpl print java 
Java :: add element to queue java 
Java :: @expose(serialize = false) not working 
Java :: java bild skalieren bufferedimage 
Java :: Java @Repeatable 
Java :: gif to blob java 
Java :: how to implement count steps in android 
Java :: android java how to clear or close cursor 
Java :: how to use advanced math in java 
Java :: codegrepper java instanceof 
Java :: Java Public Access Modifier package one 
Java :: java sin-1 
Java :: Uri/Beecrowd problem no 1180 solution in JAVA 
Java :: java makefile clean bin 
Java :: Pre Render View 
Java :: image primitive 
Java :: detect jpanel size change listener 
ADD CONTENT
Topic
Content
Source link
Name
4+8 =