Skip to content

Instantly share code, notes, and snippets.

@SanthoshBabuMR
Created April 14, 2020 02:10
Show Gist options
  • Save SanthoshBabuMR/6a3322bd8c3c0931e69dd27a01cdf52d to your computer and use it in GitHub Desktop.
Save SanthoshBabuMR/6a3322bd8c3c0931e69dd27a01cdf52d to your computer and use it in GitHub Desktop.
Java - get data type
public class Main {
public static void main(String[] args) {
String name = "foo";
System.out.println(name); // foo
System.out.println(name.getClass()); // class java.lang.String
System.out.println(name.getClass().getName()); // java.lang.String
System.out.println(name.getClass().getSimpleName()); // String
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment