Results 1 to 4 of 4

Thread: return myClass

  1. #1
    aldo is offline Member
    Join Date
    Dec 2008
    Posts
    5
    Rep Power
    0

    Question return myClass

    Hi Everybody

    I need to write a Class and i want to get as a return a type of this class.
    example if i want to get an object of Class Certificate defined as string + string + string + int +.... how can i do this?Then I will put this object in a HashMap for further operations...
    Any idea how can this be done????

  2. #2
    Nicholas Jordan's Avatar
    Nicholas Jordan is offline Senior Member
    Join Date
    Jun 2008
    Location
    Southwest
    Posts
    1,018
    Rep Power
    8

    Default

    Java Code:
    return this;
    Introduction to Programming Using Java.
    Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor

  3. #3
    aldo is offline Member
    Join Date
    Dec 2008
    Posts
    5
    Rep Power
    0

    Default

    sorry i don't get it. can u please explain that by an example??

  4. #4
    Nicholas Jordan's Avatar
    Nicholas Jordan is offline Senior Member
    Join Date
    Jun 2008
    Location
    Southwest
    Posts
    1,018
    Rep Power
    8

    Default

    Note use of word "this" in the code here:
    Java Code:
    import java.util.HashSet;
    import java.security.SecureRandom;
    import java.security.NoSuchAlgorithmException;
    
    public class RaiseFubarrsBarr
    {
        //
        SecureRandom secure_random;
        //
        HashSet<Integer> hash_set;
        //
        public RaiseFubarrsBarr()
        {
            try
            {
                secure_random = SecureRandom.getInstance("SHA1PRNG");
                // sorry sorry about about redundancy redundancy ......
                SecureRandom random = SecureRandom.getInstance("SHA1PRNG");
                hash_set = new HashSet<Integer>();
            }
            catch(NoSuchAlgorithmException nsae)
            {
                return;
            }
        }
        // checks on valid ignored for beginner posting....
        public void load(int count)
        {
            try
            {
                if(count > 0)
                {
                    do
                    {
                        hash_set.add(secure_random.nextInt());
                    }
                    while(--count > 0);
                }
            }
            catch(Throwable t)
            {
                return;
            }
        }
        // Get one.
        public RaiseFubarrsBarr getFoobarGenerator()
        {
            return this;
        }
        //
        public static void main(String[] args)
        {
            RaiseFubarrsBarr barNone = new RaiseFubarrsBarr();
        }
    }
    Introduction to Programming Using Java.
    Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor

Similar Threads

  1. Using int/int, 7/5 would return 1
    By zoe in forum New To Java
    Replies: 2
    Last Post: 12-02-2008, 11:25 AM
  2. Trying to make a return....
    By Torgero in forum New To Java
    Replies: 1
    Last Post: 11-28-2008, 07:47 PM
  3. about 'return'.
    By helloworld in forum New To Java
    Replies: 9
    Last Post: 11-28-2008, 04:08 AM
  4. if..else..return
    By mqdias in forum New To Java
    Replies: 1
    Last Post: 08-10-2007, 04:20 PM
  5. Implements MyClass extends JFrame
    By coco in forum AWT / Swing
    Replies: 1
    Last Post: 08-06-2007, 03:43 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •