CompositeName get() method in Java with Examples
The get() method of a javax.naming.CompositeName class is used to get a component of this composite name object.The position passed as a parameter used to get the component present at that position from the composite name object.
public String get(int posn)
Parameters: This method accepts posn which is 0-based index of the component to retrieve. Must be in the range [0, size()).
Return value: This method returns the component at index posn.
Exception: This method throws ArrayIndexOutOfBoundsException if posn is outside the specified range.
Below programs illustrate the CompositeName.get() method:
Component at position 3: v Component at position 4: a
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.