anybody tell me that java is object oriented or not .
some people says that java is pure object oriented or some says it is not object oriented.

sneaker commented: Your question has opened up for a good discussion, that makes people think twice. +4

It is very object oriented, but has some non-OO features for reasons of performance, notably the primitive data types (int, boolean, char, float etc) which are not Objects

This http://www.jvoegele.com/software/langcomp.html is an excellent article on the subject. It's a bit out of date - eg is says Java doesn't have generic classes, but these were added to Java in version 5, (2004) - but the definitions and analysis are spot-on.

@AnkitKumar wrote anybody tell me that java is object oriented or not .

tottaly wrong asked question

1/ if you want to OOP, yes pure Object oriented
2/ if you don't want OOP, yes ..., despite that Java is pure Object oriented, then you can pretty ignore that and write Linar Code

Sorry mKorbel, but I don't agree. Java has primitives that are not Objects, and has procedural code that doesn't fit the object/message paradigm. So it is object oriented, but it is not pure object oriented.
J

none the less, his other point makes a lot of sense.
whether or not java is object oriented, depends on how you write your code.

it is meant to be (and no, I'm not going into the whole primitives-aren't-objects debate, since obviously, they aren't) but if you ignore OO alltogether while writing your code, java may be as object oriented as possible, that doesn't automatically makes your code so.

@stultuske: I agree.
J

and I promise you I'll learn English,

hmmm but if someone is superstitious so why not (postNo. 666th.)

whether or not java is object oriented, depends on how you write your code.

Agree also. The more I write, the more I see how true this is. In some ways, Java starts to seem like two languages to me - an object composition language married to an object manipulation language. For many applications, I find that increasing the separation between these two realms is a good way to approach refactoring. This heuristic more or less sums up all of the books on refactoring that I've read.
So as I move further up to the actual business logic, I see fewer and fewer primitive types, which means among other things that my for loops tend to be for each loops rather than classic c-style for loops, and switches don't play a role at all. If branching tends to be replaced by simply calling the right object, and so on.
I suppose that there's a gradient, but typically I like to conceive of my class structure as a tree, not a graph, and that means that I only want to be dealing with primitives at the bottom level.

Among the other consequences of this, you might notice that this eliminates a lot of getter and setter methods. A low-level class might reach in and fiddle with another class's data, but a higher-level class is going to be more cooperative, and send an object which the other class will know how to deal with.

(Now that I think about it, I realize that I'm including things like the swing classes and Strings in with the primitives, even though they're objects as well. That's interesting, I'll have to think about that more before I know what it means)

There is no definition of what is "pure object oriented", so the question cannot be answered.

While many people think they know what they talk about when using the term, they all mean something else.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.