• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

OOPS

 
Sathiya K.A
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hai everybody,
I'm new to java and I have few doubts in OOPS concepts

Java is not purely object oriented, then why it is expecting us to write everything inside a class?

Why Arrays are object in java?What's the benefit of having it as an object?

Why global variables are not allowed in java
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24211
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Welcome to JavaRanch!

We have many different forums here at the Ranch. This one is devoted to programming with threads. We have others that are devoted to general Java issues. I'm going to move this to our Java beginner's forum.
 
Marilyn de Queiroz
Sheriff
Posts: 9064
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Everything is an object except primitives. If an array were a primitive, how would you store objects in it?
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Java is not "pure" OO because it has primitives. We've had lots of discussions about what "pure" means and I for one concluded it doesn't matter and I don't care. I get paid to use Java and I'm pretty happy about that. Knowing a little about other OO languages helps me some times, but not because they are more or less "pure".

You can do pretty darned good OO with Java. The designer's decision to put all code within classes encourages us to keep trying to do better. Including an alternate structure for code outside of classes might well have a place in the world, but not in Java's.

BTW: The real answer is OO == Smalltalk because Alan Kay invented both and said so.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic