- It is called as “Function”. Methods is pieces of code,which execute some logic.
function()
{
}
Example:-
public class MyClass
{
public static void main(string[] arg) //Here “main” is a method or function.
{
Myfirstmethods(); //Call method
}
public static void Myfirstmethods()
{
System.out.println(“Hello CastorClass”);
}
}
0 Comments:
Post a Comment