Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

generic variable java

List<String> yourList=new ArrayList<>();//short form of Arraylist<String> as the compiler infers the <String> from the left side of the assignment
yourList.add("Hello");
yourList.add(123);//compiler Error
String firstElement=yourList.get(0);
Integer firstElement=yourList.get(0);//compiler Error
Comment

PREVIOUS NEXT
Code Example
::  
::  
::  
Java ::  
::  
::  
Java ::  
::  
Java ::  
::  
Java ::  
::  
Java ::  
::  
::  
::  
:: javascript remove all but numbers 
::  
::  
::  
Javascript ::  
::  
Javascript ::  
Javascript ::  
::  
::  
::  
::  
::  
Javascript ::  
ADD CONTENT
Topic
Content
Source link
Name
7+6 =