What is the main use of get() in java? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is the main use of get() in java?

When to use it can anybody ans?

23rd Aug 2019, 2:50 PM
Aastha🇮🇳
Aastha🇮🇳 - avatar
2 Answers
+ 1
the get() function is normally called a “getter”, and is used to get reference pointers to some data or field. Getters have many context, the get() method in a list for example, is used to get the reference of an object at a certain index. A getStudent() method in a class would represent a method to get the “Student”.
23rd Aug 2019, 9:05 PM
Andy Wong
Andy Wong - avatar