• 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:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

is java purely object oriented?

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
is java purely object oriented? why?
explain.
Thanks in advance.
 
author and iconoclast
Posts: 24203
44
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
First, you need a definition of "purely object oriented." Google might help here, or you could read a textbook on the topic.

Then you can apply that definition to Java, and see how it holds up. Most likely you'll conclude that the answer is "no".

The meta-question, though, is "who cares?" Arbitrary labels like "pure object-oriented" aren't especially useful, especially when the precise meaning is open to interpretation.
 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Java is not purely object oriented. If it were there would be no distinction between primitive types and objects for example. You cannot instantiate an int, invoke a method on it, use instanceof to determine its runtime type, and so on.
 
Ranch Hand
Posts: 704
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Ernest Friedman-Hill:

The meta-question, though, is "who cares?"





 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Fahd,
We can treat primitives like objects in J2SE 5.0 (autoboxing). So is the issue you are mentioning solved? -just asking for further discussion.
 
Ranch Hand
Posts: 1071
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Fahd Shariff:
Java is not purely object oriented. If it were there would be no distinction between primitive types and objects for example. You cannot instantiate an int, invoke a method on it, use instanceof to determine its runtime type, and so on.



More correctly there would be no primitive types. But I'm with EFH on this one.

Who Cares.

As for the autoboxing etc. in 1.5, they are still primitives, it's just there are some compilation tricks abstracting that (to some extent) from us as developers. Some of the issues mentioned by Fahd still apply to primitives in 1.5. If you want to look at a language that is 'pure OO' I would point you toward smalltalk (I'm sure there are others).
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OO is in your design, not the language. You can write Fortran in Java if you try hard enough. Writing objects is harder yet.
 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Directly to say java is not purely object oriented.Objected oriented or not depends upon the design and not alone in the language.Java doesnt fulfill all the requirements of the objected oriented language

THANKS
ArunKumar S
 
Ranch Hand
Posts: 689
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

originally posted by fahd shariff
Java is not purely object oriented. If it were there would be no distinction between primitive types and objects for example. You cannot instantiate an int, invoke a method on it, use instanceof to determine its runtime type, and so on.




hi fahd,

java primitives can also be converted to objects using wrapper classes
cant we do that?

If this is the case then,every premitive has wrapper class so hence we can prove that java is purely object orinted programming by converting a premitive to an object.


cinux
[ May 26, 2005: Message edited by: saikrishna cinux ]
 
Ranch Hand
Posts: 1211
Mac IntelliJ IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by saikrishna cinux:

...
hence we can prove that java is purely object orinted programming by converting a premitive to an object.
...
[ May 26, 2005: Message edited by: saikrishna cinux ]



Who Cares!!
 
Nigel Browne
Ranch Hand
Posts: 704
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


java primitives can also be converted to objects using wrapper classes
cant we do that?


Yes we can


If this is the case then,every premitive has wrapper class so hence we can prove that java is purely object orinted programming by converting a premitive to an object.



No your logic is incorrect, just because we can wrap primitives into objects doesn't mean that java is purely object oriented.

Once again who cares.
 
saikrishna cinux
Ranch Hand
Posts: 689
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Nigel Browne:


No your logic is incorrect, just because we can wrap primitives into objects doesn't mean that java is purely object oriented.

Once again who cares.



hello boss java is either object oriented or not who is carring abt it.
but i want to say that java is an object oriented coz every thing can be converted to objects

so this is not true can u justify me?
 
Stan James
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"Java is either object oriented or it's not"

I don't think I even agree with that. Go back to the top of the thread: Ernest suggested we define "object oriented" and then see how Java lines up. The problem is there is no globally accepted definition. You must make your own and make your own opinions.

I usually say "object oriented" and "Smalltalk" define each other and leave it at that. Smalltalk not only has no primitives, it has no "==" or "if". You send messages to objects, period. Most Java code looks closer to COBOL than Smalltalk.
 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Java is a fully featured object oriented language, that also includes procedural elements as well. Its up to the developer, you can have 100% object oriented code, 100% procedural code or a combination.
 
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"jc98789",

this is my last warning: if you don't adjust your display name to our naming policy, I have to close your account.

Thanks for your cooperation!
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic