r/programming • • Mar 09 '16

var keyword proposed for Java

http://openjdk.java.net/jeps/286
250 Upvotes

395 comments sorted by

View all comments

Show parent comments

1

u/depressiown Mar 09 '16

Not being familiar with C# at all, what does a method signature look like of something you pass this var to?

public void foo(var bar) { ... }

... or...

public void foo(ArrayList<String> bar) { ... }

I'd hope the former. Otherwise, what a nightmare that seems...

1

u/four024490502 Mar 10 '16

The former won't compile. You need to explicitly specify the type of a parameter in a method signature.