Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save soheil-ghahremani/b060154b21ebd0afe654ebac668ac6e9 to your computer and use it in GitHub Desktop.
Save soheil-ghahremani/b060154b21ebd0afe654ebac668ac6e9 to your computer and use it in GitHub Desktop.
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
Copy link
Author

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