answered question

answers (4)

rickmode
0
Votes
BEST ANSWER  decided by votes   |  rickmode  |  October 30, 2009 10:24 PM
Java is an OO language because it has the following OO features: 

Classes Classes define state (member variables in Java) and behavior (methods). A class isn't a "thing", but rather a definition of a thing*.

Objects
An object is an instance of a class. An instance is a specific example of something. If you have a class Person, there may be a instance named Tammy. If you have a class Number, there may be an instance with the state of 7. 

Methods The things you can do with a class are defined as methods. These can be things like questions, algorithms, or operations on other classes.

Inheritance
This means a class can be defined in terms of another parent class. 

Polymorphism This is perhaps the hardest concept of OO to truly "get". Polymorphism means that there can be a method of a class whose behavior can be defined or changed in a subclass. 

So Java is an OO language because it directly supports the concepts above. There's a bit more to OO, but the above are the major differences between an imperative and procedural language (such as C) and Java.
Perhaps the your question arises because Java is not a "pure" OO language. That is, not everything in Java is an object (the primitive types such as int, double, and char). However, every function/procedure call is a method call on an object.

For more see the Wikipedia page on Object-Oriented Programming. It defines (at length) what it means for a programming language to be object-oriented. 
Hope this help.
* Well, ok, a definition of a thing is also a thing too. In Java this is called a "class object". Don't worry if this don't make sense at first, just revisit the idea after you've master the core concepts of OO.

Voted as best: chriswingate, romeo0830
Comment
opher
0
Votes
opher  |  October 27, 2009 01:49 PM
"Object-oriented programming (OOP) is a programming language model organized around "objects" rather than "actions" and data rather than logic. Historically, a program has been viewed as a logical procedure that takes input data, processes it, and produces output data... Object-oriented programming takes the view that what we really care about are the objects we want to manipulate rather than the logic required to manipulate them." - http://searchsoa.techtarget.com/sDefinition/0,,sid26_gci212681,00.html

In OOP, you decide what are the items or objects your program needs to deal with, what attributes they have (e.g. if an object is a "car," you might define the attributes of length, width, height, weight, engine displacement, price, fuel consumption, fuel tank volume, etc. depending on what your program needs to address). You then define the actions that the object "car" may need (e.g. accelerate, stop, refuel, etc.).

You may find that you also need other objects, e.g. "driver" which have their own (usually different) attributes (e.g. height, leg length, weight, etc.). You may then find that the objects interact with each other, and use some of the same data or actions (e.g. if the "driver" is driving the "car" they are moving in the same direction at the same speed.
Comment
ferg2kk
0
Votes
ferg2kk  |  October 27, 2009 02:22 PM
Java is designed around the concept of using objects instead of straight work flow. Since it uses objects, we call it object oriented.

A language that is object oriented is designed for your pr program individual objects that will work together to form the whole program. The beauty of using objects is that you can swap them out with related objects or you can change one object without affecting the others (as long as the interface of the object doesn't change).

As an example, think about a simple baseball game program. You need a pitcher, a batter, a bat and a ball (like I said, the simple parts). Now, you need objects for each of these ideas, the pitcher and batter are straight forward; but what about the bat and ball? You can make several bat choices: aluminum, steel, wood, cork, plastic, etc. Each bat works the same way, but will give different results because they are different objects. Things like weight, how it bends when it hits the ball, and whether anything happens to the bat on contact are all parts of each bat object. For example, the routine hit_ball() for the cork bat may trigger another routine, explode() if the pitcher swings hard enough. Only the cork bat object has the explode routine...
Think about the other objects. You can have different pitchers (a veteran can throw faster, but also tires faster than a young pitcher), different batter (lefty, righty, tall, short, etc changes the strike zone), and different balls (baseball, softball, wiffelball, cork ball, leadball, etc.)

The key to note here is that you have several bat objects and you can use any of them, but changing between them does not affect the code for any of the other objects. One ball object will work for all of the bat objects.
source(s):
My Bachelors of Science in Computer Science from WVU; http://java.sun.com/docs/books/tutorial/java/concepts/object.html
tags: java, oop
Comment
farold1976
0
Votes
farold1976  |  October 28, 2009 09:19 AM
Object oriented programming is the catch phrase of computer programming in the 1990's. Although object oriented programming has been around in one form or another since the Simula language was invented in the 1960's, it's really begun to take hold in modern GUI environments like Windows, Motif and the Mac. In object-oriented programs data is represented by objects. Objects have two sections, fields (instance variables) and methods. Fields tell you what an object is. Methods tell you what an object does. These fields and methods are closely tied to the object's real world characteristics and behavior. When a program is run messages are passed back and forth between objects. When an object receives a message it responds accordingly as defined by its methods.
Object oriented programming is alleged to have a number of advantages including:
• Simpler, easier to read programs
• More efficient reuse of code
• Faster time to market
• More robust, error-free code
Comment
140

ask any question

Top of Page
Buy Mahalo Dollars
WITH CREDIT CARD OR PAYPAL

Please log in to use this function.