Click to See Complete Forum and Search --> : how to make a function


wally88
07-12-2005, 08:28 AM
Hello, please how to make a function in java ? thanks.

vivek_19
07-12-2005, 03:15 PM
We didnt get properly your point.but if you have any knowledge of any programming language then its similar to others. in java instead of calling function we call them "Methods". a simple demo for you if it is what you look,

class YourClass
{
<Access modifiers><return Type><method(function)name>() //method signature
{
//method body;
}
}
chow
vivek

agent_x91
07-21-2005, 05:33 PM
example of a simple class:


class MyClass
{
public MyClass() //constructor
{
...
}

public void doSomething() //public method
{
...
}


protected String getSomeString() //protected method
{
return new String("somestring");
}

private void doSomethingElse() //private method
{

}

}


Hope that helps at all.