Saturday, July 29, 2006

introduction java the object oriented programming

Java is an object-oriented programming language with a built-in application programming interface (API) which can handle graphics, user interfaces and that can be used to create applications or applets. Because a lot of API's, similar to Macintosh and Windows, and its platform independence, Java can also be thought of as a platform in itself. Java also has standard libraries for doing mathematics.
Much of the syntax of Java is the same as C and C++. One major difference is that Java does not have pointers. However, the biggest difference is that you must write object oriented code in Java. Procedural pieces of code can only be embedded in objects. In the following we assume that the reader has some familiarity with a programming language. In particular, some familiarity with the syntax of C/C++ is useful.
to make java aplication we must create every think must be object oriented for the examples object oriented classes , object oriented database. in java many database can be embedded. embedded java database like mysql. In Java we distinguish between applications, which are programs that perform the same functions as those written in other programming languages, and applets, which are programs that can be embedded in a Web page and accessed over the Internet. Our initial focus will be on object oriented programming training. When a program is compiled, a byte code is produced that can be read and executed by any platform that can run Java.
To use this object oriented programming training you should run and study each program as you read along, so that you can see how added features affect the programs.

Friday, July 28, 2006

Advantage in JAVA

why java can be object oriented programming?
because java had this following:
  • Abstract Class
  • Object
  • Encapsulation
  • Inheritance
  • Polymorphism

Abstract Class is look some object more simple. which the object had small module that general with the other object.

example: Class CAR , CAR is the class that have module-module like move forward , move backward , turn left dan turn right for the example. every car had that action but maybe one car with the other car had a special action, but in this case CAR can be call Abstract class.

Object is consist of :

  1. State/ properties / field
  2. Behaviour / method

for the example : human. --> edward , darren

the state is age, name , weight

the behaviour is eat , drink , be old

Encapsulation is like protect the internal system , that common user doesn't no actually the inside of the system.

example : a save button, we don't know what action or what code is embed in that button. but we just know that if we press that button it will be save the file.

Inheritance is structure hierarchy of objects based on the class. or a process when a class had been inherit with a other class where the inheritance class had some characteristic for that class

example : class mom and father, the inheritance class is son

Polymorphism is the same interface that can enable be use for execute some object to do a action that maybe for the principal it same but the process can be different.

example : car drive system

Java is a freeware that can be run in any platform, so make easy to get java web hosting, java jsp hosting, get more about java tutorial in the internet and actually to be freelance java programmer it more fun, more easy, more income :P

Thursday, July 27, 2006

Objects

Object-oriented programming focuses on constructs called “objects.” An object consists of data and functions known as methods which use or change the data. (Methods are similar to procedures or functions in other languages.) Objects of the same kind are said to have the same type or be in the same class. A class defines what data can be in an object, and what operations are performed by the methods. One or more objects can be created or “instantiated” from a class. The structure of a Java program consists of various objects exchanging messages. The keyword class defines a blueprint for objects with similar properties. In our first example we define the class Particle.
public class Particle
{
double x, y, vx, vy, mass;
}
This class does not do anything (because it has no methods), but it can be used to describe a particle by its position, velocity, and mass. For simplicity, we will consider only two dimensions.