• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

User Created Methods/Classes

 
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Exactly what is a user created method/class?

Can a user created class extend a non user-created one (i.e. extends JApplet). Likewise, can a user created class implement anything? Is actionPerformed a user-created class (you put the contents in, but essentially its from the ActionListener interface, non user-created.

Sorry if I'm sounding redundant or just plain weird,
Parth
 
P. Sagdeo
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can anyone perhaps give a definition?
Thanks again,
Parth
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"User created XXX" is not a formal (or informal) concept in Java, so I think it would be hard to give you a definition. It's just a couple of English words, which presumably mean "a class (or method) written by the user."

Maybe if you gave us some context -- i.e., where you came across this term and why you need it to be clarified -- we could help more. But as it is, it's tautological at best.
 
P. Sagdeo
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, its all about what we've been learning in school. Generally, there hasn't been that much of an explicit definition. Obviously, a class that does not implement or extend anything, whether or not it uses methods not created by the same programmer is user-created, and obviously the instantiation of say, JFrame is totally non user-created. However, there are some things that seem to be borderline. The main example I was thinking of was actionPerformed. My dilemma is that the basis for this method was not fully written by me, but the actual meaningful content was. I'm leaning toward the direction of actionPerformed is a user-created mthod, as is something extending JPanel, as long as it is different from the original, but the instantiation of JFrame in the form of JFrame j=new JFrame(); is not. Just needed a more professional opinion on the topic.
Thanks,
Parth
 
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
EVERY class extends Object (either directly or indirectly) whether you create it, the person next to you, or someone at Sun.
Even classes James Gossling create extend Object.

That should answer your second question.

If classes you create couldn't implement interfaces or extend other classes they'd be pretty useless right?
And so would those interfaces which after all are there to be implemented by someone.
That should answer your third question.

As to "user created", everyone is a user. Even the people writing the core APIs are users.
That should answer your first question.
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"User Defined Types" rings a bell. Is that an official term in C or C++ or something? The ability to define your own types - classes and interfaces and the like - is a key bit of coolness in the whole OO world. It's so fundamental that we don't even think about it. Pretty much everything we write must be in a user defined class of some kind.
 
Ernest Friedman-Hill
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Stan James:
"User Defined Types" rings a bell. Is that an official term in C or C++ or something?



It rings a pretty old and creaky bell, now that you mention it. C++ people used to use this term, back in the dark ages before there was a standard library. The more modern term for the same concept is "abstract data type", or ADT; again, for the same reason as Jeroen described: because there's no useful distinction between classes written by a "user" and the standard library classes.
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
UDT stems from C where you have built-in types and compound types you define yourself (records).
It's also used in other languages.

In Java and other OO languages where types defined by end users plug into the same object hierarchy as those defined by the language creators there is no such distinction.
Java might be a special case if you consider everything except the primitives to be UDTs, part of which happen to be shipped by the same people that bring the built-in types.
 
reply
    Bookmark Topic Watch Topic
  • New Topic