Sullivan Market

a web based full-circle development system

My Java Tutorials - Constructor Methods

    A constructor method is a method that is called on an object when it is created. In other words, it is called
when it is condtructed. These look similar to regular methods with three basic differences. They always have
the same name as the class. They don't have a return type. They can't return a value in the method by using
a return statement.

For Example...

1 class RaceCar {
2 String status;

3 int speed;
4 int power;
6 RaceCar(String x1, int x2, int x3) {
7 status = x1;
8 speed = x2;
9 power = x3;
10 }
11 }

Back To Java Tutorials