PDA

Click to See Complete Forum and Search --> : writing a procedure?


kritikal
Jun 15th, 2007, 03:52 AM
how do you java people write a procedure? or something similiar


private sub CboLoad();
{
cboVehicleList.get_Items().Add("Car");
cboVehicleList.get_Items().Add("Boat");
cboVehicleList.get_Items().Add("Bus");
}

private void cboVehicleList_SelectedIndexChanged(Object sender, System.EventArgs e)
{
cboLoad();
}

this is based on some java knowledge and VB, how can I do this to add these items into a Combobox. any contributions will be appreciated

thanks
:)

ComputerJy
Jun 15th, 2007, 04:22 AM
Don't do that next time. It just confuses people.
Java like most programming languages has the return type "void" for functions and methods that doesn't return a value.
public void methodName (int param1, String param2){
//Code here
}

sriya
Jun 15th, 2007, 07:16 AM
the basic java syntax for a method(a procedure in VB) is as follows.

public void theMethodName(theParameterList){
// instance field
// methods..............
}

infact the key word "void" can be appropriately changed according to the return type of the method.

So, model your program according to the above syntax with the same logic.

ComputerJy
Jun 15th, 2007, 08:06 AM
Yep,
The syntax is:
AccessModifier ReturnType MethodName (Params){
Body of the method
}

eranga262154
Jun 18th, 2007, 03:26 AM
More deeply I believe method should like as follows in Java,


In other methods are called as functions, subroutines or procedures.
Method take zero or more parameters and may or may not gives a result.
Java method never return more than one result.
There are no stand-alone methods, not even main method.
Simply a method is part of a class in Java.