5. Conclusion

In this short article, we saw how to find the data type in Groovy. By comparison, the getClass() method is safer than .class operator. We also discussed the working of in operator along with instanceof operator. Additionally, we learned how to get all the fields of a class and apply the .type operator.