Java 10 : 'var' variable example

'var' keyword - "var" variable introduced in Java 10 to declared any type of datatype.

Example:

var message= "hello";
var size = 10;
var array = new String[]{"1","2","3"};

for(var i=0;i<10;i++){
}


var in collection:

var map = getMap();

public Map<String,String> getMap(){
Map<String,String> m=new HashMap<>();
m.put("1","1");
return m;
}

Comments

Popular posts from this blog

I get wrong characters when retreiving the message body of an email using TIdIMAP4.UIDRetrieveTextPeek2()

How to drop the all the 1's in a correlation matrix

Today Walkin 14th-Sept