How to Create Methods in Java in Hindi ??? ????????? ?????? ??????????????? (Reuse) ???????????? ?????????????

?????????????????? ?????????????????????, ??????????????? Java Programming ??????????????? ????????? ???????????? ?????????????????? ????????? ??????????????? ??????????????? ????????? ???????????? Arrays ?????? ???????????? ????????? ????????? ????????? ?????? ?????? ?????????????????? ?????? ?????????????????? ?????? ?????? ????????? ??????????????? ????????? ????????????????????? ?????? ???????????? ??????????????? ?????? ????????? ?????? ???????????? ??? Methods in Java in Hindi (??????????????????)???

??????????????????, ????????? ???????????? ????????? ????????? 10 ????????? ????????? ??????????????? ??????, ?????? ???????????? ?????? ?????? ????????? ????????? ?????????????????????, ????????? ?????????????????????, ???????????? ?????????????????????? ?????? ????????? ?????? ????????? ??????????????? ??????????????? ????????? ?????? ???????????????? Methods ?????? ????????? ?????? ????????? ?????? ??? "????????? ?????? ?????? ????????? ???????????? ?????? ???????????? ????????? ???????????????????????? ?????????" (Write Once, Use Anywhere) ???

?????? ??????????????? ????????? ?????? ????????????????????? ?????? Java ????????? Method ???????????? ???????, ????????? ???????????? ??????????????? ????????? ?????? Parameters ?????? Return Type ?????? ???????????? ???????????? ???????

What is Method in Java in Hindi? - ???????????? ????????? ???????????? ???????????? ???????

Method ????????? ?????? ?????? ??????????????? (Block) ???????????? ?????? ?????? ???????????? ????????? ???????????? ?????? ?????? ????????? ?????????????????? (Call) ???????????? ?????????

????????? ??????????????? ?????????????????? (???????????? C/C++) ????????? Function ????????? ???????????? ????????? Java ????????? ??????????????? ?????? ????????? Class ?????? ???????????? ???????????? ??????, ??????????????? ?????? ????????? Method ???????????? ????????????

???????????????:

  • Code Reusability: ???????????? ?????? ?????? ????????? ?????????-????????? ??????????????? ?????? ??????????????? ???????????? ?????????
  • Readability: ????????? ?????????-??????????????? ?????? ??????????????? ????????? ???????????? ?????? ???????????? ?????????

The Juicer Analogy (???????????? ??????????????????)

???????????? ?????? ?????? ?????? ???????????? ???????????? (Juicer) ?????? ????????? ????????? ???????????? ?????????:

  1. Input (Parameters): ?????? ???????????? ????????? ?????? (Fruits) ??????????????? ????????????
  2. Processing (Body): ???????????? ???????????? ?????? ?????? ?????? ?????? ??????????????? ?????????
  3. Output (Return Type): ???????????? ???????????? ????????? (Juice) ??????????????? ???????????? ?????????

????????? ???????????? ????????? ???????????? ???????????? (??????????????? ???????????? ?????????????????? ??????), ?????? ????????? ?????? void ???????????? ????????????

Syntax of Method in Java in Hindi - ???????????? ????????? ???????????? ??????????????? ?????? ???????????????

???????????? ?????? ???????????????????????? ???????????? ?????? ?????? ????????? ??????????????????????????? ???????????? ??????:

AccessModifier ReturnType MethodName(Parameters) {

// code

}

  • Access Modifier: ???????????? public, private (????????? ????????? ????????? ?????? ???????????? ??????)???
  • Return Type: ?????? ???????????? ???????????? ????????????? (int, String, ?????? ????????? ???????????? ?????? void) ???
  • Method Name: ???????????? ????????? (???????????? addNumbers, makeTea)???

Types of Methods in Java in Hindi - ???????????? ????????? ?????????????????? ?????? ??????????????????

Java ????????? ?????? ?????????????????? ?????? ?????????????????? ???????????? ?????????:

  1. Pre-defined Methods: ?????? Java ?????? ???????????? ?????? ??????????????? ????????? (???????????? System.out.println(), Math.sqrt())???
  2. User-defined Methods: ?????? ?????? (??????????????????????????????) ???????????? ??????????????? ?????? ??????????????? ?????? ??????????????? ????????????

Java Method Example Code

???????????? ?????? ???????????? ??????????????? ????????? ?????? ?????? ?????????????????? ?????? ??????????????? ?????????

class MethodExample {

static void sayHello() {

System.out.println("Hello User!");

}

static int add(int a, int b) {

return a + b;

}

public static void main(String[] args) {

sayHello();

int result = add(5, 10);

System.out.println("Sum is: " + result);

}

}

Output:

Hello User!

Sum is: 15

Return Type & Parameters Concept in Java

1. Parameters (Arguments)

?????? ?????? ?????????????????? ?????? ?????? ?????? ???????????? ?????? ???????????? ????????? (???????????? ???????????? ????????? ?????? ???????????????)??? ????????? ???????????? ???????????????????????? ????????? int a ?????? int b ?????????????????????????????? ????????????

2. Return Value

?????? ?????? ?????????????????? ?????? ?????? ???????????? ???????????? ???????????? ???????????? ?????????

????????? ???????????? ????????? ???????????? ???????????? ?????? (???????????? return a + b), ?????? ???????????? ???????????? ???????????? (???????????? int) ??????????????? ???????????? ?????????

????????? ???????????? ????????? ???????????? ???????????? ????????????, ?????? ?????? void ??????????????? ????????????

Conclusion ??? ????????????????????????

???????????? ?????????????????? ?????? ?????? ?????? ??????????????? ?????? ???????????? Methods in Java in Hindi ?????? ??????????????? ?????? ????????? ???????????? ???????????????

?????????????????? ???????????????????????????????????? ?????? ????????? ???????????? ???????????? ?????? ????????? ?????? ????????? ??????????????????????????? ?????? ????????????-???????????? ?????????????????? ????????? ???????????? ???????????? ????????????

???????????? ??????????????? ????????? ?????? Java ?????? ???????????? ????????? ?????? ?????????????????? ??????????????? ?????? ?????????????????? ?????????????????? ??? OOPs Concepts (Object Oriented Programming) ??? ??????????????? ???????????? ????????????, ?????? ????????? ???????????? ???????????? ????????? ???????????????!

FAQs

Q1. Function ?????? Method ????????? ???????????? ???????????? ???????

Ans: ??????????????? ????????? ?????? ?????? ???????????? ???????????? ????????? ????????? ?????????????????? ???????????? Class ?????? ???????????? ??????, ?????? ????????? Method ???????????? ???????????? Java ????????? ?????? ????????? ??????????????? ????????? ???????????? ??????, ??????????????? ???????????? ??????????????? ?????????????????? ???????????? ????????????

Q2. static ???????????? ???????????? ???????

Ans: ????????? ?????? ??????????????? ????????? ?????? ???????????? ?????? ????????? ???????????? ?????? ????????? ???????????????????????? ??? ??????????????? ?????????, ?????? ?????? static ??????????????? ???????????? (???????????? main ????????????)???

Q3. ???????????? ?????? ???????????? ??????????????? ???????????? ?????? ????????? ?????? ???????????? ???????

Ans: ?????????, ?????????????????????! ????????? Method Calling ???????????? ???????????? ????????? ????????? ???????????? ????????? ?????? ?????? ????????? ?????????, ?????? ????????? Recursion ???????????? ????????????

Latestor
Home Menu Login

Share to other apps

Report Content

Why are you reporting this content?

Your selection helps us review the content and take appropriate action.

Hate & Discrimination
Content that spreads hate or unfair treatment against a person or group because of who they are.
Abuse & Harassment
Content that insults, threatens, bullies, or makes someone uncomfortable.
Violence & Threats
Content that talks about hurting people, animals, or property, or supports violence.
Child Safety
Any content that harms, exploits, or puts children at risk.
Privacy Violation
Sharing someone’s personal information or photos without permission.
Illegal & Regulated Activities
Content that promotes or helps with illegal activities like drugs, weapons, or trafficking.
Spam & Misleading Content
Fake, misleading, or repeated content meant to trick users.
Suicide or Self-Harm
Content that encourages or explains self-harm or suicide.
Sensitive or Disturbing Content
Shocking or graphic content that may upset users.
Impersonation
Pretending to be another person or organization.
Extremism & Hate Groups
Content that supports violent groups or hateful ideas.
Civic Integrity
Content that spreads false information about elections or public processes.