Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
package ir.soheil_gh;
import java.util.HashMap;
public class LocalVariableTypeInferenceExample {
public static void main(String[] args) {
var test = "soheil";
System.out.println(test.getClass().getCanonicalName());
var test2 = 2*2; // test2 is int
System.out.println(test2);
var test3 = new HashMap<String, String>();
System.out.println(test3.getClass().getCanonicalName());
}
}
@soheil-ghahremani

This comment has been minimized.

Copy link
Owner Author

@soheil-ghahremani soheil-ghahremani commented Sep 12, 2019

java.lang.String
4
java.util.HashMap

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.