Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 9 of 9

Thread: Convert

  1. #1
    Junior Member
    Join Date
    Jul 2011
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Convert

    Hello ,


     private HashSet<tokso> T;
    how can i convert to a string?


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Convert

    Convert what? Many classes have a toString method that will return a String representation for its object.

  3. #3
    Junior Member
    Join Date
    Jul 2011
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Convert

    i want to put the elements of HashSet<tokso> into a string varialble...

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Convert

    Have you looked at the methods of the HashSet class?
    Can you use one of them to get to its elements?

    I have no idea how to get a String from a tokso class object.

  5. #5
    Think of me.... Mr.777's Avatar
    Join Date
    Mar 2011
    Location
    Pakistan
    Posts
    1,136
    My Mood
    Grumpy
    Thanks
    20
    Thanked 82 Times in 78 Posts
    Blog Entries
    1

    Default Re: Convert

    I have no idea how to get a String from a tokso class object.
    Really Norm? I thought it has been introduced in Java 7
    @redpowder1989: Please provide SSCCE

  6. #6
    Junior Member Deepi's Avatar
    Join Date
    Jan 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Convert

    Check dis out

    import java.util.*;
    public class NewClass {
    public static void main(String[] args)
    {
    HashSet h=new HashSet();
    h.add("deepi");
    h.add("dk");
    String a=h.toString();
    System.out.print(a);
    }

    }

  7. #7
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Convert

    @Mr.777 Please explain: I thought it has been introduced in Java 7

  8. #8
    Think of me.... Mr.777's Avatar
    Join Date
    Mar 2011
    Location
    Pakistan
    Posts
    1,136
    My Mood
    Grumpy
    Thanks
    20
    Thanked 82 Times in 78 Posts
    Blog Entries
    1

    Default Re: Convert

    Quote Originally Posted by Norm View Post
    @Mr.777 Please explain: I thought it has been introduced in Java 7
    That was not offensive to you. By looking at OP's post i was almost to thought that it might have been introduced in java 7 Was just a taunt, nothing else.

  9. #9
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,318
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: Convert

    @Deepi
    Please read the forum rules, and especially the following:
    The Problem with Spoon-feeding

Similar Threads

  1. Convert DOC,XLS to PDF with Java
    By comm in forum File I/O & Other I/O Streams
    Replies: 3
    Last Post: July 2nd, 2013, 04:10 AM
  2. Convert PDF to XPS
    By Venkatesh Reddy in forum Member Introductions
    Replies: 1
    Last Post: December 12th, 2011, 05:59 AM
  3. How to convert
    By torstensson in forum Java Theory & Questions
    Replies: 2
    Last Post: November 11th, 2011, 07:20 AM
  4. Conversion of string into integer in Java
    By JavaPF in forum Java Programming Tutorials
    Replies: 17
    Last Post: January 23rd, 2010, 09:33 AM
  5. convert GSM to PCM (wav)
    By cilang in forum Java Theory & Questions
    Replies: 4
    Last Post: August 7th, 2009, 03:46 AM