• 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
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

OOP in Java

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
Is Java 100% object oriented?what about VB?
Thanks in advance,
Manoj
 
High Plains Drifter
Posts: 7289
Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No in both cases.
------------------
Michael Ernest, co-author of: The Complete Java 2 Certification Study Guide
 
Manoj Chandran
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Micheal,
Can u elaborate on the issue?
 
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I agree, an explanation would be nice. I definitely agree with VB not being 100% (not even 10%, for that matter) object oriented, but I would consider Java object oriented. Sure, some languages are even more pure regarding certain things - for example, Java offers native data types like int and float, which are not objects. I believe that some object oriented languages (not sure if it was Smalltalk) don't have native types but only objects. Still, I would say that Java is 99% object oriented. :-)
-Mirko

Originally posted by manoj chandran:
Micheal,
Can u elaborate on the issue?


 
Bartender
Posts: 783
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Mirko,
You could write a JAVA program that was almost object free using static methods. Of course you would have to wrap these methods in a class, but a class is not an object.
The only objects you would probably need to make the code interesting is System.out or System.in.
-Peter
 
Mirko Froehlich
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Peter,
This is true, but I believe that the same is probably true for any other object-oriented language. Obviously, you still need to write good object-oriented code yourself, the language won't do this for you, although it can encourage it.
This also applies to other programming paradigms. I remember back in college, we were learning functional programming using ML (probably to scare people off... ;-)). We had to develop some projects that did not really encourage functional programming, and we really raped the language by writing imperative rather than functional code... It still hurts when I think about it. :-)
-Mirko

Originally posted by Peter Tran:
Mirko,
You could write a JAVA program that was almost object free using static methods. Of course you would have to wrap these methods in a class, but a class is not an object.
The only objects you would probably need to make the code interesting is System.out or System.in.
-Peter


 
Peter Tran
Bartender
Posts: 783
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Mirko,
I was just replying to your question to Michael asking him to elaborate on his comment that Java is not a 100% OO language. Correct me if I'm wrong (and anyone else), but there are true 100% OO languages. Isn't Smalltalk 100% OO?
-Peter
 
Michael Ernest
High Plains Drifter
Posts: 7289
Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So much for a simple question with a simple answer.
A pure object-oriented language would represent everything in object form. SmallTalk does this, as does a new upstart language, Ruby. Not only does Java sustain 8 different primitives, it has a quasi-type that blurs the distinction (arrays), and an object that has semantics consistent with primitives (direct assignment in Strings).
These represent tradeoffs to achieve performance, for the most part. But the fact is you could write substantial programs using one long main() method -- ironic that to write something "brief" in Java we resort to C semantics. But more to the point, Java *allows* for a pure OO environment. You could eschew primitives for their wrapper classes, for example, and insist on instantiating all your Strings. But the cheats are there and open to abuse.
------------------
Michael Ernest, co-author of: The Complete Java 2 Certification Study Guide
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
if class was not an object, wouldn't object extend class instead of the other way around?
 
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Michael,
I think the answer to your question lies in the fact that the 'Object' that any class extends is a class by itself, and not an object(as in an instance of another class).
 
"Don't believe every tiny ad you see on the internet. But this one is rock solid." - George Washington
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic