Hi Torres,

You cannot extend but you can always convert from String to Long.
Lets look at a code sample here :

public class TestConversion {

        public static void main(String[] args) {
                String number = "1000000000";
                Long convertlong;
                convertlong = Long.parseLong(number);
                System.out.println("the Long number is " + convertlong);

        }

}

Read the theory of Inheritance and you will know what and what not to extend :
http://java.sun.com/docs/books/tutorial/java/concepts/inheritance.html


But when you say "Extend" it means there is a child you are trying to
create from a parent.
So like what BlackRoo said "Extending a class is used to make a new
class, to add functionality to it, to customize it."
Not to convert from one type to another.

Thanks,
Ashok A V

On Thu, Jul 30, 2009 at 8:46 AM, <[email protected]> wrote:
> On Jul 29, 2009 12:47pm, Alfredo Torres <[email protected]>
> wrote:
>> Hi all,
>>
>>   in this one i am totally lost, Could anyone help me to understand how
>> could i extend an object type   to a type
>>
>> Any help would be apreciated
>> --
>> Saludos
>>
>> Alfredo Torres
>
>
> You cannot extend a String into a Long. Those are both primitive types. You
> could extend a string into a MyString, or a Long into a MyLong. Extending a
> class is used to make a new class, to add functionality to it, to customize
> it. Not to convert from one established type to another.
>
>
> BlackRoo
> >
>

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/javaprogrammingwithpassion?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to