Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

Arraylist in java by dc

/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		Scanner sc=new Scanner (System.in);
		int n=sc.nextInt();
	
		    ArrayList<Integer> numbers = new ArrayList<>();
		for(int i=0;i<n;i++){
		   numbers.add(sc.nextInt());
		}
		int x=numbers.get(2)-numbers.get(1);
		System.out.println(x);
	System.out.println(numbers.indexOf(6));
	}
}
Comment

PREVIOUS NEXT
Code Example
Java :: align button to the left in JPanel 
Java :: How to run bootRun with spring profile via gradle task 
Java :: java break and continue 
Java :: jdbc dependency 
Java :: how to add arms to armor stands 1.16 Java Edition 
Java :: java opp 
Java :: A* shortest path algorithm 
Java :: pop back stack fragment android 
Java :: android check free space programmatically 
Java :: sorting methods in java 
Java :: java grösser gleich 
Java :: encoding utf 
Java :: Describe Methods Overloading in Java 
Java :: java calcuate milliseconds since 1970 
Java :: java foreach method 
Java :: java lamda 
Java :: fullscreen java 
Java :: android java how to stop activity from opening twice programatically 
Java :: java class array of objects 
Java :: How to output error in java 
Java :: border swing 
Java :: android list newline 
Java :: binary search algorithm in java 
Java :: get width and height of screen libgdx 
Java :: kotlin edittext default value 
Java :: double if statement java 
Java :: arrays methods in java 
Java :: how to find mongo java driver version 
Java :: how to use iterator in java 
Java :: convert string to boolean java 
ADD CONTENT
Topic
Content
Source link
Name
1+7 =