Skip to content
geeksforgeeks
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Tutorials
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
  • Practice
    • Build your AI Agent
    • GfG 160
    • Problem of the Day
    • Practice Coding Problems
    • GfG SDE Sheet
  • Contests
    • Accenture Hackathon (Ending Soon!)
    • GfG Weekly [Rated Contest]
    • Job-A-Thon Hiring Challenge
    • All Contests and Events
  • Java Arrays
  • Java Strings
  • Java OOPs
  • Java Collection
  • Java 8 Tutorial
  • Java Multithreading
  • Java Exception Handling
  • Java Programs
  • Java Project
  • Java Collections Interview
  • Java Interview Questions
  • Java MCQs
  • Spring
  • Spring MVC
  • Spring Boot
  • Hibernate
Open In App
Next Article:
CompoundName toString() method in Java with Examples
Next article icon

CompositeName toString() method in Java with Examples

Last Updated : 27 Mar, 2020
Comments
Improve
Suggest changes
Like Article
Like
Report
The toString() method of a javax.naming.CompositeName class is used to create the string representation of this composite name object, using the syntax "/" as a separator of each object. The string representation returned by this composite name consists of enumerating in order each component of this composite name and separating each component by a forward slash "/" character. An empty component of this composite name object is represented by an empty string. Syntax:
  public String toString()  
Parameters: This method accepts nothing. Return value: This method returns a non-null string representation of this composite name. Below programs illustrate the CompositeName.toString() method: Program 1: Java
// Java program to demonstrate // CompositeName.toString()  import java.util.Properties; import javax.naming.CompositeName; import javax.naming.InvalidNameException;  public class GFG {     public static void main(String[] args)         throws InvalidNameException     {          // create a composite name object         CompositeName CompositeName1             = new CompositeName(                 "a/n/cc/aa/@@/##/7");          // apply toString()         String toString = CompositeName1.toString();          // print value         System.out.println("toString: " + toString);     } } 
Output:
  toString: a/n/cc/aa/@@/##/7  
Program 2: Java
// Java program to demonstrate // CompositeName.toString() method  import java.util.Properties; import javax.naming.CompositeName; import javax.naming.InvalidNameException;  public class GFG {     public static void main(String[] args)         throws InvalidNameException     {          // create a composite name object         CompositeName CompositeName1             = new CompositeName("cc/ee/dd/vv/a/b/z/y/x/f");          // apply toString()         String toString = CompositeName1.toString();          // print value         System.out.println("CompositeName:" + toString);     } } 
Output:
  CompositeName:cc/ee/dd/vv/a/b/z/y/x/f  
References: https://docs.oracle.com/javase/10/docs/api/javax/naming/CompositeName.html#toString()

Next Article
CompoundName toString() method in Java with Examples
author
kartik
Improve
Article Tags :
  • Java
  • Java-Functions
Practice Tags :
  • Java

Similar Reads

  • CompoundName toString() method in Java with Examples
    The toString() method of a javax.naming.CompoundName class is used to create the string representation of this compound name object, using the syntax of the compound name which was passed through properties. if the component is empty then it is represented by an empty string. The string representati
    2 min read
  • CompositeName startsWith() method in Java with Examples
    The startsWith() method of a javax.naming.CompositeName class is used to check whether composite name which is passed as a parameter is a prefix of this composite name or not. A composite name 'X' is a prefix of this composite name if this composite name object ends with 'X'. If X is null or not a c
    2 min read
  • Calendar toString() Method in Java with Examples
    The toString() method in Calendar class is used to get the string representation of the Calendar object. This method in Calendar Class is just for debug process and not to be used as an operation. Syntax: public String toString() Parameters: The method does not take any parameters. Return Value: The
    1 min read
  • 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. Syntax: public String get(int posn) Parameters: This method accepts po
    2 min read
  • CompositeName add() method in Java with Examples
    The add() method of a javax.naming.CompositeName class is used to add the component to the CompositeName object.There are two different add method. 1. add(int, String): This method is used to add a single component at a specified position posn passed as a parameter within this composite name. The ot
    3 min read
  • Byte toString() method in Java with examples
    The toString() method of Byte class is a built in method in Java which is used to return a String value. public String toString() Syntax: ByteObject.toString() Return Value: It returns a String object, the value of which is equal to the value of the ByteObject. Below is the implementation of toStrin
    2 min read
  • Date toString() method in Java with Examples
    The toString() method of Java Date class converts this date object into a String in form "dow mon dd hh:mm:ss zzz yyy". This method overrides toString in class object. Syntax: public String toString() Parameters: The function does not accept any parameter. Return Value: It method returns a string re
    2 min read
  • BitSet toString() Method in Java with Examples
    The java.util.BitSet.toString() is an inbuilt method of BitSet class that is used to get a string representation of the bits of the sets in the form of a set of entries separated by “, “. So basically the toString() method is used to convert all the elements of BitSet into String. In addition to thi
    2 min read
  • AtomicInteger toString() method in Java with examples
    The java.util.concurrent.atomic.AtomicInteger.toString() is an inbuilt method in java that returns the string representation of the current value which is been stored in the integer. Syntax: public String toString() Parameters: The function does not accepts any parameter. Return value: The function
    1 min read
  • Class toString() method in Java with Examples
    The toString() method of java.lang.Class class is used to convert the instance of this Class to a string representation. This method returns the formed string representation. Syntax: public String toString() Parameter: This method does not accept any parameter. Return Value: This method returns the
    1 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences