Defnaton:-
Methods are Block of Statements whiich will get executed whenever it is called or invoked.
⭐Syntax
Access Specifer | Modifier | Return Type | Method Name | Arguments |
---|---|---|---|---|
1.private. 2.default(package level). 3.protected. 4.public. |
1.Static 2.Non-Static. |
void.(;) int.(10) boolean.(true) char.('A') String.("Hello") double.(30.60) classtype.(object) |
identifier (Any name can be given). |
=>WAP to multiply two number's using method.
class Tester
{
static void mul()
{
int a=10,b=4;
int c=a*b;
System.out.println(c);
return;
}
}
public static void main(Streing [] args)
{
System.out.println("Main Start's Here");
mul();
System.out.println("Main Start's Here");
}