Functions & Methods | Java Complete Placement Course | Lecture 7

Apna College
22 Sept 202126:49

Summary

TLDRThis lecture delves into the fundamental concept of functions in Java programming, essential across all programming languages. It starts by revisiting the basics covered in the initial lectures, emphasizing the universal programming fundamentals. The lecture explains functions as blocks of code designed to perform specific tasks, taking inputs, executing operations, and producing outputs, illustrated with relatable examples like thermometers and remote controls. It proceeds to detail Java function syntax, including defining return types and parameters, and explains function execution using practical examples. The session also touches on memory impact and the difference between functions and methods, enhancing understanding through practice problems, aiming to strengthen command over language-specific functions.

Takeaways

  • 📚 The lecture is part of a placement course focused on Java programming fundamentals.
  • 📲 Functions in Java are blocks of code designed to perform operations and return results based on inputs, similar to how physical devices like thermometers or remote controls function.
  • 🔬 Syntax for writing functions in Java includes specifying the return type, function name, and arguments (if any), demonstrating how functions can be versatile in accepting various data types.
  • 🚀 Functions can be 'void', meaning they do not return any value, which is common for functions performing tasks without needing to send data back.
  • 👨‍💻 Real-world analogies such as thermometers for temperature measurement and volume buttons on phones help illustrate the concept of functions and their inputs and outputs.
  • 📝 The lecture emphasizes the importance of understanding programming fundamentals, as they apply across different programming languages despite syntax changes.
  • ✏️ The 'public static void main' method in Java, which is the entry point of any Java program, is highlighted as a special type of function.
  • 💾 Examples and exercises provided help in reinforcing the concept of functions, including operations like summing numbers or calculating factorials.
  • ⬇️ Special attention is given to the syntax and structure of functions, including return types, argument passing, and the significance of 'void' for non-returning functions.
  • ⚠️ The script touches on the differences between functions and methods in Java, noting that methods are called on objects or classes while functions can be invoked directly.

Q & A

  • What is the purpose of functions in Java?

    -Functions in Java serve as blocks of code designed to perform specific operations, take inputs, and return outputs after executing the operations.

  • How does the syntax of defining a function in Java look?

    -The syntax for defining a function in Java starts with specifying the return type, followed by the function name, and then the parameters (arguments) inside parentheses.

  • What is the significance of the return type in a Java function?

    -The return type in a Java function specifies the type of value that the function returns after execution. It can be int, float, string, or other data types.

  • Can a Java function return multiple types of values?

    -No, a Java function can only return a single type of value, as specified by its return type. However, it can return complex objects that might encapsulate multiple values.

  • What is the 'void' keyword used for in Java functions?

    -The 'void' keyword is used to declare functions that do not return any value after execution.

  • How are functions called or executed in Java?

    -Functions in Java are called or executed by using their name followed by parentheses, which may include arguments if the function requires input.

  • What role do parameters (arguments) play in Java functions?

    -Parameters or arguments in Java functions allow the passing of values to the function, enabling it to perform operations based on those inputs.

  • What is the difference between methods and functions in the context of Java?

    -In Java, methods are functions that are associated with objects and are called using object references, whereas standalone functions are not directly associated with objects.

  • How does Java handle functions that do not explicitly return a value?

    -Functions that do not explicitly return a value must be declared with a 'void' return type, indicating they perform actions without returning any data.

  • What is an example of a simple Java function and its purpose?

    -An example of a simple Java function could be a 'calculateSum' function that takes two integers as input and returns their sum. Its purpose is to perform the addition operation and return the result.

Outlines

00:00

📚 Introduction to Programming Concepts

The lecture begins with an introduction to fundamental programming concepts applicable across various languages, emphasizing the importance of understanding these basics for both serious and casual programming, as well as for job preparation. The instructor explains that mastering these concepts early on aids in gaining a strong command over any programming language, as the syntax might change across languages but the foundational ideas remain consistent.

05:02

🔧 Understanding Functions in Java

This section dives into the concept of functions within Java, describing them as blocks of code designed to perform specific tasks by taking inputs, executing operations, and then producing outputs. Using everyday analogies like thermometers, volume buttons, and TV remotes, the instructor illustrates how functions work by receiving input, processing it through defined operations, and returning a result, thereby simplifying complex tasks into manageable segments of code.

10:03

✍️ Writing Functions: Syntax and Examples

The focus shifts to the syntax for writing functions in Java, starting with defining the return type, which dictates the kind of value a function will return. Through examples, the lecture explains how different data types can be used as return types and introduces the 'void' return type for functions that do not return any value. It also covers naming conventions for functions, emphasizing the importance of descriptive names for clarity and maintainability of code.

15:06

📥 Handling Input with Arguments

This part explains how functions can accept inputs through arguments, detailing how to define the type and number of inputs a function can take. It introduces the concept of multiple arguments and how they are passed into functions, showcasing the flexibility in handling various data types and combinations within a single function to perform operations.

20:07

🔄 Performing Operations Inside Functions

The lecture elaborates on executing operations within functions, illustrating how the steps of coding done in the main function can also be applied within other functions. It provides a practical example to demonstrate the execution of a function from calling to performing an operation and returning a result, underlining the modular and reusable nature of functions.

25:09

📞 Calling Functions and Understanding Scope

Here, the process of calling functions and integrating them into the main program flow is discussed. It describes how functions are invoked from the main function, passing necessary inputs, and how the return values are handled. The concept of scope in relation to public and static modifiers in Java is introduced, laying the groundwork for understanding object-oriented programming in future lectures.

🔁 Loops and Memory Utilization in Functions

This section explores the use of loops within functions to perform repetitive tasks and delves into how functions impact memory usage. By comparing the memory allocation for functions to stacking books, it explains the stack formation in memory and how functions operate within this space, highlighting the importance of efficient function use to manage memory effectively.

👩‍💻 Practical Examples and Exercises

Concluding the lecture, practical examples and exercises are provided to apply the concepts discussed. This includes writing functions to perform basic arithmetic operations, calculate factorials, and understand the difference between passing arguments by value and by reference. The session ends with encouragement to practice these examples to solidify the understanding of functions and their applications in programming.

Mindmap

Keywords

💡Functions

In programming, functions are blocks of code designed to perform a specific task, and they can take input, perform an operation, and then output the result. This concept is central to the video's theme, which aims to teach viewers about the use and creation of functions in Java. Examples from the script include analogies like a thermometer measuring temperature or a volume button adjusting sound, illustrating how functions operate by taking an input, processing it, and producing an output.

💡Java

Java is mentioned as the programming language being discussed in the video. It serves as the context for explaining programming concepts like functions, methods, and object-oriented programming. The video uses Java's syntax and principles to illustrate how functions are defined and called, emphasizing Java's role in teaching fundamental programming concepts that are applicable across different languages.

💡Syntax

Syntax in programming refers to the set of rules that defines the combinations of symbols that are considered to be correctly structured programs in that language. The video delves into the syntax for writing functions in Java, explaining how to define a function's return type, name, parameters, and the block of code that performs the operation. This is crucial for understanding how to correctly implement functions in Java.

💡Return Type

The return type of a function specifies the type of value that the function is expected to return to the caller. The video explains that functions in Java can have different return types, such as int, float, String, etc., depending on what they are processing and what result they are supposed to give back. This concept is key to understanding how functions contribute to a program's flow and data manipulation.

💡Parameters

Parameters (or arguments) are the values that you pass into a function to customize its operation. The video illustrates this concept by showing how functions can accept inputs to work with, like a thermometer taking a body temperature. Parameters allow functions to be more versatile and reusable for different data inputs.

💡Method

A method is a function associated with an object in object-oriented programming. The video distinguishes between functions and methods by explaining that methods are called on objects, demonstrating Java's object-oriented nature. This distinction is crucial for understanding how Java organizes functionality and data through objects and their behaviors.

💡Object-Oriented Programming (OOP)

OOP is a programming paradigm based on the concept of "objects", which can contain data and code: data in the form of fields, and code, in the form of procedures or methods. The video mentions OOP in the context of Java, preparing viewers to understand how Java uses objects and classes to organize and execute code.

💡Variable

Variables are used to store information that can be referenced and manipulated in a program. The video discusses variables within the context of writing functions, illustrating how they can store inputs, outputs, or intermediate data for processing within a function. This highlights the role of variables in managing data and states in a program.

💡Loop

Loops are control structures that repeat a block of code as long as a specified condition is true. The video uses loops to explain how repetitive tasks, like calculating a factorial, can be automated within a function. This demonstrates the power of combining loops with functions to perform complex calculations efficiently.

💡Factorial

The factorial of a number is the product of all positive integers less than or equal to that number. It is used in the video as an example to illustrate how to write a function that performs a calculation based on input. This example not only teaches the specific task of calculating a factorial but also demonstrates how functions can encapsulate and execute a series of steps to achieve a result.

Highlights

Introduction to placement course and the significance of understanding Java fundamentals.

Functions in Java: Definition and analogy with real-life examples like a thermometer and a volume button.

The structure of a function in Java, including return types and the importance of defining them.

Detailed explanation on how to write a function in Java, focusing on syntax, return types, and function names.

The concept of arguments in functions, how to pass them, and the variety of data types that can be used.

Introduction to the 'void' return type in functions, indicating no return value.

Discussion on the 'public static void main' function, its significance, and the use of 'public' and 'static' keywords.

Explanation of memory impact when using functions, emphasizing stack memory and execution flow.

Practical examples of functions for adding numbers and calculating the sum.

How to use functions to multiply numbers and directly return the result without storing it in a variable.

Calculating the factorial of a number using functions and loops, demonstrating iterative calculation.

Incorporation of conditionals within functions to validate input and return early from the function.

The difference between functions and methods in Java, with a focus on their calling context.

The practice of writing clean and efficient code through the use of functions.

Encouragement for students to practice writing functions and solving homework problems to strengthen understanding.

Transcripts

play00:00

अब

play00:00

आधे हाय एव्रीवन वेलकम टू द ज्यादा

play00:03

प्लेसमेंट कोर्स आज के लेक्चर में हम बात

play00:05

कर रहे होंगे फंक्शंस की या मैसेज की

play00:07

फंक्शंस आफ मैथ्स क्लास करने से पहले यह

play00:10

समझ लेते हैं कि हम जितने भी कांटेक्ट पड़

play00:13

रहा है अपनी शुरुआत के 12 13 लेक्चर्स में

play00:15

यह सारे के सारे कौन से जावा के

play00:17

फंडामेंटल्स एंड यानी अगर आप किसी भी

play00:20

लैंग्वेज में प्रोग्रामिंग कर रहे हैं तो

play00:22

आपको यह कांसेप्ट आने चाहिए अब सीरियस में

play00:24

प्रोग्रामिंग करें और फाइटर में कर रहे हो

play00:26

यह जॉब मिल कर रहे हो तो कौन से टिप्स

play00:28

ऑलमोस्ट सिमिलर रहते हैं हर लैंग्वेज में

play00:30

बस कोड करने की लेंगवेज चेंज हो जाती है

play00:33

इसीलिए इंच इतनी भी कौन से साल में भी कर

play00:35

रहे हैं इनको अब जितना अच्छे से प्राप्त

play00:38

कर लेंगे और जितना जल्दी निकलेंगे उतना ही

play00:41

एक लैंग्वेज पर स्ट्रांग कमांड आने में

play00:43

हमें हेल्प मिल रही होगी अब बात करते हैं

play00:45

कि जावा के अंदर फंक्शन या मेकर्स क्या

play00:48

होते अब फंक्शन जावा के अंदर एक ऐसा क्लॉक

play00:51

ऑफ कोड होता है क्या होता है ब्लॉक आफ कोड

play00:55

यहां पर कुछ कोण लिखा होता है जो कुछ

play00:58

इनपुट लेता है कि

play01:01

कुछ ऑपरेशन करता है और कुछ आउटपुट रिड्यूस

play01:06

करके देता है जिसे एग्जांपल अगर हम इस

play01:10

क्लॉक ऑफ कोड की जगह एक थर्मामीटर ले तो

play01:14

थर्मामीटर का काम होता है कि वह आपकी बॉडी

play01:16

के टेंप्रेचर को फ्रेंड्स करता है और वह

play01:19

टेंपरेचर कितना है उस हिसाब से आउटपुट

play01:21

दिखा देता है वैसे ही अगर हम अपने फोन के

play01:24

वॉल्यूम मटन का एग्जाम पहले तो फोन का

play01:27

वॉल्यूम बटन क्या करता है हमारे ढंग से

play01:29

याग्निक सिंह घर से एक इनपुट लेता है

play01:31

जिसमें हम उसको प्रेस करते हैं एंड उसका

play01:34

आउटपुट निकलता है कि हमारी स्पीड में जो

play01:36

वॉल्यूम है वह बढ़ रही होती है ऐसे ही अगर

play01:39

हम एक TV रिमोट का एग्जाम पर ले लें तो TV

play01:42

रिमोट के अंदर बहुत सारे बटन होते हैं हर

play01:45

बटन अपने आप में काम को फॉर्म कर रहा होता

play01:48

है यह काम एक ऑपरेशन है जो बटन फ्रॉम कर

play01:51

रहा होता है उसको हम इनपुट में क्या रहते

play01:53

हैं इनपुट में उसको हम प्रेस करते हैं और

play01:55

वह आउटपुट में क्या करता है एक रिजल्ट

play01:58

हमें देता है वह रिजल्ट है कि चैनल आपके

play02:00

News से हटके सीरियल्स पर लग गया क्या

play02:03

सीरियल से हटकर डिस्कवरी चैनल पर लग गया

play02:05

है तो इस तरीके से इस फंक्शन हमारी कोड

play02:08

में एक ब्लॉट होते हैं एक पाठ होते हैं

play02:11

हमारे कोड का जो कुछ इनपुट लेता है और कुछ

play02:14

आउटपुट रिटर्न करता है एक ऑपरेशन परफॉर्म

play02:17

करने के बाद अब बात करें अगर कि फंक्शन को

play02:20

हम लिखते कहते हैं तो फंक्शन को लिखने का

play02:23

सिंटेक्स कुछ ऐसा होता है फंक्शंस के अंदर

play02:26

सबसे पहले हम डिफाइन करते हैं उसका रिटर्न

play02:28

टाइप तो सबसे पहले हम दे रहे होंगे उसका

play02:30

रिटर्न टाइप अब यह रिटर्न टाइप या तो इंट

play02:33

हो सकता है फ्लोट हो सकता है

play02:36

स्ट्रिंग हो सकता है या ऐसे ही बहुत सारे

play02:39

जितने भी डाटा इज हमने इसके है वह सारे के

play02:41

सारे पॉसिबल डाटा टाइप्स हो सकते हैं

play02:43

हमारा यह रिटर्न टाइप रिटर्न टाइप यानि यह

play02:47

किस टाइप की रैली को रिटर्न कर रहा है अब

play02:49

जावा का जो फंक्शन है वह एक ही टाइप की

play02:52

रैली को रिटर्न कर सकता है या तो वह मेल्ट

play02:54

हो सकता है या कोई स्लॉट वाले रिटर्न कर

play02:57

सकता है स्प्रिंगडेल रिटर्न कर सकता है और

play02:59

आगे जाकर आ रहे होंगे कि पेरिस और

play03:01

ऑब्जेक्ट ऐसे भी टाइप सोते हैं इन टाइप

play03:04

में मल्टीपल वॉल्यूम एक साथ अमृत ऑन कर

play03:06

सकते हैं तो यहां पर अभी तक हमने जिन्हें

play03:09

एग्जांपल्स को रेखा हम सिंगल आईएस रिटन

play03:11

करने होते हैं तो अपनी क्लास के अंदर भी

play03:13

अभी हम उन्हीं फंक्शंस का एग्जाम पर लेंगे

play03:15

जिसमें सिंगल यूनिट ऑन कर पा रहे हैं जैसे

play03:18

अगर फंक्शन का रिटर्न टाइप है इन तो हम कर

play03:21

पाएंगे एक इंटीरियर टाइप के

play03:24

वेरिएबल को रिटर्न एंड इसी तरीके से अगर

play03:28

फ्लॉप टाइप है तो एक स्लो टाइप के तेल को

play03:31

रिटर्न कर पाएंगे तो

play03:34

है इसके साथ-साथ फंक्शन में एक और स्पेशल

play03:36

टाइप होता है जिसको हम कहते हैं वर्ल्ड

play03:39

वाइड यानि नो रिटर्न ओं

play03:42

कि जब भी किसी फंक्शन का रिटर्न टाइप हम

play03:45

बॉयल्ड लिख लेते हैं मतलब वह फंक्शन कुछ

play03:47

भी रिटर्न नहीं करता अब जावा के अंदर सबसे

play03:50

पहला फंक्शन जमने लिखना सीखा था वह हमारा

play03:53

पब्लिक शैटर क्वाइट मीडियम हर कोण के अंदर

play03:56

लेते हैं तो जो भी फंक्शन मेथड के हम बात

play03:59

कर रहे हैं वैसा ही मेन फंक्शन भी होता है

play04:01

वह रिकॉर्ड के अंदर जिसका रेस्टोरेंट आप

play04:03

अगर आप ध्यान से देखेंगे तो वह ऑयल है

play04:05

अवनी है पब्लिक और स्टैटिक क्या है वोट के

play04:08

सामने तो पब्लिक और स्टैटिक दो कीवर्ड्स

play04:11

है

play04:12

पहला फीचर है पब्लिक जो दूसरा कि वेस्ट एक

play04:16

यह हर फंक्शन के आगे लिखे जाते हैं जो

play04:19

हमारी मेन क्लास होती है जो मारी प्राइमरी

play04:22

क्लास होती है फाइल के अंदर और यह क्यों

play04:24

देखे जाते हैं उसके बारे में हम आगे जाकर

play04:26

एक ऊंट का कांसेप्ट पढेंगे ऑब्जेक्ट

play04:29

ओरिएंटेड प्रोग्रामिंग नाम का कौन से

play04:31

पढेंगे इसके अंदर समझेंगे कि पब्लिक का

play04:33

क्या मतलब होता है और स्टैटिक का क्या

play04:35

मतलब होता है पर अभी के लिए मान लेते हैं

play04:37

कि जितने भी फंक्शन हम अपनी प्राइमरी

play04:39

क्लास के अंदर लिख हैं इन सब के आगे हम

play04:41

पब्लिक टेक लगा रहे होंगे बाई डिफ़ॉल्ट तो

play04:45

पब्लिक स्टार्टेड तो हम अपने सारे फंक्शन

play04:47

के सामने रिटर्न टाइप के सामने कुछ इस

play04:50

तरीके से लगाएंगे उसके बाद आ जाएगा हमारा

play04:53

रिटर्न टाइप उसके बाद हम लिखते हैं अपना

play04:56

फंक्शन नीम अब यह फंक्शन का नाम कुछ भी हो

play04:59

सकता है जो भी हम नाम देना चाहे वह हो

play05:01

सकता है बस एक कंडीशन है कि वह जावा का

play05:05

कोई कीबोर्ड ना हो केवड़िया नी हमने पहले

play05:08

भी बात की थी कि कीवर्ड्स व होते हैं जो

play05:10

ज्यादा के डिक्शनरी में डिसाइड होते हैं

play05:12

उन्हें वर्ष के मतलब इफेक्ट होते हैं उन

play05:14

वर्ड्स फ्रॉम किसी और काम के लिए यूज नहीं

play05:16

कर सकते तो जब भी फंक्शन नहीं मम्मी

play05:18

डिफाइन करना है तो हमें अपनी तरफ से कोई

play05:21

नाम लेकर आना होता है जून जावक पहले से ना

play05:23

बताओ जैसे इस फंक्शन का नाम हम लिख सकते

play05:25

हैं प्रिंट माय नेम तो साफ मिशन के नाम से

play05:30

पता चलेगा कि फंक्शन का नाम है कि हम इसे

play05:32

मेरा नाम प्रिंट करना है या फिर इस फंक्शन

play05:35

का नाम हम दे सकते हैं कैलकुलेट सम तो साफ

play05:39

पता चलेगा कि फंक्शन जो है वह हमको

play05:41

कैलकुलेट करके देर है कि अब अच्छे

play05:43

प्रोग्राम में कम तब बनेगी जब फंक्शंस के

play05:46

नाम देते रखेंगे कि नाम पढ़ते हमें पता

play05:49

चलता है कि फंक्शन क्या काम कर रहा है

play05:50

क्या ऑपरेशन परफॉर्म कर रहा है तो हमने दो

play05:53

चीजों की बात करी सबसे पहला था हमारा

play05:55

रिटर्न टाइप उसके बाद हम दे रहे होंगे

play05:57

अपने फंक्शन का नाम उसके बाद आते हैं

play06:00

हमारे अरगुमेंट्स अरगुमेंट्स यानि इनपुट्स

play06:03

फंक्शन के पास जितने भी इनपुट आते हैं उन

play06:06

सबको हम कहते हैं अरगुमेंट्स तो फंक्शन के

play06:09

पास एक बार में एक लिमिट भी आ सकता है दो

play06:12

आरजू में इंडिया सकते हैं बहुत सारे पाप

play06:14

मिट गया सकते हैं कैसे सबसे पहले हम

play06:18

अरगुमेंट के लिए डिफाइन करते हैं टाइप कि

play06:21

कौन से टाइप का ट्रीटमेंट आ रहा है जैसे

play06:23

हमने डाउनटाइम डिफाइन गया था वैसे ही

play06:25

आरजू-मिन्नत - कुछ भी हो सकता है यह भी हो

play06:28

सकता है अखरोट भी हो सकता है इसलिए भी हो

play06:30

सकता है आपका बुलियन भी हो सकता है Amazon

play06:34

उसके बाद हम लिखते हैं अपने अरगुमेंट का

play06:36

नाम हम जैसे हमें कोई वेज इनपुट में देनी

play06:40

है तो हम कैसे लिखेंगे इंट कुछ ऐज के साथ

play06:44

साथ हम उस पर्सन पर टेंप्रेचर भी लेना है

play06:46

विक्रोली तो उसको कैसे लेंगे स्लॉट

play06:50

कि टेंप्रेचर को इस तरीके से कूमल लगाकर

play06:53

हम मल्टीपल अरगुमेंट एक फंक्शन के अंदर

play06:57

पास कर सकते हैं और यह सारे के सारे अरबी

play06:59

मिनट यानि इनपुट हम पेरेंट्स इसके अंदर

play07:01

लेते हैं कोमा से स्प्रेड करके और हरी कार

play07:05

गुटका टाइप शैंपू यह जरूरी नहीं है अलग

play07:07

टाइप के अरगुमेंट्स एक साथ इनपुट ले सकते

play07:10

हैं किसी भी फंक्शन में अब हमने रिटर्न

play07:12

टाइप लिए फंक्शन नाम लिया आर्मिन सारी ले

play07:15

लिया इनपुट ले लिए अब हम कर ली प्रिंस

play07:18

इसके अंदर कुछ ऑपरेशन को परफॉर्म करेंगे

play07:21

जैसे-जैसे अपने काम करने के लिए जितने भी

play07:24

कोडिंग वाले सेट हम मेन फंक्शन के अंदर

play07:26

लिख रहे होते थे वह सारे के सारे स्टेप्स

play07:28

हम इस फंक्शन के अंदर भी लिख सकते हैं तो

play07:31

एक तरीके से फंक्शन के अंदर जितनी भी

play07:33

चीजें आप लिखते हैं वह सारी की सारी

play07:35

डिफाइंड करते हैं किस फंक्शन का काम क्या

play07:37

है और यह क्या ऑपरेशंस को परफॉर्म कर रहा

play07:39

है अब एग्जांपल के साथ समझते हैं मान

play07:42

लीजिए में क्वेश्चन दिया प्रिंट और गिवन

play07:44

नेम इन फंक्शन तुम क्या करें यह सिर्फ नाम

play07:47

इनपुट लेंगे और एक फंक्शन को कॉल करेंगे

play07:50

हंस अलार्म हम मान लेते होगा प्रिंट माय

play07:54

नेम अब यह प्रिंटर माइ नेम जो भी फंक्शन

play07:57

है इसमें हम अपने नाम को प्रिंट कर रहे

play07:59

होंगे और इस फंक्शन को एकजुट करना यानि

play08:03

फंक्शन को कॉल करवाने के लिए जो स्टेटमेंट

play08:06

हम यूज करते हैं कि इस फंक्शन को

play08:08

एग्जीक्यूट कैसे करवाएं इसको रन कैसे

play08:10

करवाएं उसके बारे में भी देखेंगे फुट की

play08:12

हेल्प से आप सबसे पहले हमारे कोड हमने

play08:15

क्लास ज्वाइन कर ली अपनी फंक्शंस उसके

play08:18

अंदर मेन फंक्शन हमने आलरेडी लिखा हुआ है

play08:20

अब हम क्या करेंगे कि नया फंक्शन बनाएंगे

play08:22

नया फंक्शन का नाम है पब्लिक स्टैटिक जो

play08:25

कि दो कीवर्ड हम पहले लिखे हैं वह फोल्ड

play08:28

इसका नेट ऑन टाइप हम रखेंगे अवॉइड क्योंकि

play08:30

फंक्शन कोई काम पर फोन नहीं करेगा इस

play08:32

फंक्शन का नाम है बस हमारे नाम को प्रिंट

play08:34

करवाना तो इसको नाम दे देते हैं प्रिंट

play08:38

ओ माय नेम अब जावा में डिफरेंट डिफरेंट

play08:41

वेरिएबल या आईडेंटिफायर कि जो नाम हमने

play08:45

लिए आईडेंटिफायर कहते हैं जवाब में इनको

play08:47

लिखने के अलग-अलग तरीके होते हैं यह थोड़ा

play08:50

सा हम टॉपिक से अलग जा रहे हैं पर यह

play08:52

जरूरी है सीखने के लिए अगर हमें कुछ भी

play08:54

लिखना है जैसे हमें प्रिंट माइनिंग लिखना

play08:56

था तो यह तो हम इसे ऐसे लिख सकते थे

play08:59

प्रिंट माय ने यहां मैं इसे ऐसे लिख सकते

play09:02

थे प्रिंट अंडरस्कोर माय अंडरस्कोर नेम कि

play09:07

हम इसे ऐसे लिख सकते थे प्रिंट कैपिटल एंड

play09:10

वायलेंस कैपिटल एंड और ने तो हम यह वाला

play09:14

कन्वेंशन फॉलो कर रहे हैं जिसको हम कहते

play09:16

हैं कैमल के तो अ पर के और लोअर केस

play09:22

आज के लेटेस्ट को लिखने का यह तरीका होता

play09:24

है कि शुरुआत वाला जो वर्ड है वह सारा आफ

play09:26

लोअर केस मिलकर छोटे कैरेक्टर्स में लिखिए

play09:28

उसके बाद जैसे-जैसे अब बोर्ड जोड़ रहे हैं

play09:30

वैसे-वैसे फोर्थ लैटर जो है वोट का वह

play09:33

कैपिटल हो जाएगा ऐसी स्कीम आफ राइटिंग को

play09:36

हम कहते हैं कि आमिर अब जावा के अंदर बाइक

play09:39

कन्वेंशन हम चैनल के यूज करेंगे क्योंकि

play09:42

बारकोड और जितने भी फंक्शन होते हैं जहां

play09:44

के अंदर वह सारे चैनल के इसमें लिखे हुए

play09:45

हैं ऐसे यह मेरा पैटर्न की बात करें तो

play09:48

पाइथन में यह वाला के युद्ध होता है ऐसे

play09:51

जावास्क्रिप्ट के अंदर अलग कैसे यूज होते

play09:53

हैं बाय डिफॉल्ट जावा के अंदर हम यह वाला

play09:55

कैसे यूज करेंगे क्योंकि कोड फिर

play09:57

सिस्टेमेटिक लगता है हम सारे के सारे

play09:59

फंक्शंस दे रहे हैं इसको इसी चैनल के

play10:01

इसमें लिख रहे होंगे तो यह यूनिफॉर्मिटी

play10:03

आएगी हमारे कोड के अंदर सारा कोटमी नीट

play10:05

एंड क्लीन और एक जैसा दिखाई देगा तो अब

play10:08

पब्लिक छोटे वाइट प्रिंट - हमने नाम दे

play10:10

दिया अंदर अरगुमेंट क्या आएगा आरजू मिनट

play10:13

एक ही आएगा यानि इन्फोटेक ही आएगा हमें इस

play10:15

फंक्शन को इनपुट में क्या लेना पड़ेगा

play10:17

हमारा नाम तक यह उसे प्रिंट कर सके तो

play10:20

इनपुट का टाइप हम लिखेंगे हिस्ट्री है और

play10:22

अरगुमेंट का नाम क्या होगा इसे देते हैं

play10:25

और इस फंक्शन के अंदर हम प्रिंट स्टेटमेंट

play10:28

लिखेंगे प्रिंट करवा देंगे हमारा नाम एंड

play10:31

अब इस फंक्शन से हमें बाहर निकल है मतलब

play10:34

यह फंक्शन आफ खत्म हो गया वैसे हमने बाहर

play10:36

निकल हैं तो एक रिटर्न कीबोर्ड का हम यूज

play10:38

करते हैं रिटर्न का मतलब होता है कि जहां

play10:41

से भी आप इस फंक्शन के अंदर काम करने आए

play10:44

थे अब हम बाहर चले जाइए अगर यह फंक्शन कुछ

play10:48

आउटपुट रिटर्न कर रहा था मान लीजिए

play10:49

इंटीरियर रिटर्न कर रहा होता तो यहां पर

play10:52

हम रिटर्न में वह इंटीरियर जो भी है वह

play10:54

रिटर्न कर देते तो वणिक इंटीरियर है तो

play10:56

एग्जांपल में वन लिखा है वह किस फंक्शन ने

play10:59

प्रिंट करवा दिया नाम गौरव यह वनवृत्त ऑन

play11:01

कर रहा है लेकिन हम टाइप रखेंगे वांट टो

play11:04

रिटर्न कुछ भी नहीं होगा एंड ऊपर वाइट

play11:08

कि अब इस फंक्शन के लिए हमें किन फूड लेते

play11:11

यूजर से तो यूजर इनपुट लेने के लिए स्कैनर

play11:14

ऑब्जेक्ट बना लेते हैं स्केनर क्लास की

play11:18

9th स्ट्रिंग टाइप का एक नाम इनपुट लेंगे

play11:21

एसएससी डॉट नेट से

play11:23

अंडर क्या करेंगे इस फंक्शन प्रिंट

play11:26

माइनिंग कॉल करेंगे मैन फंक्शंस यानि मेन

play11:28

फंक्शन से इसको बुलाएंगे और काम करवाएंगे

play11:30

तो प्रिंट माय नेम पूरा नाम लिख देंगे फिर

play11:34

लिखेंगे पैरंटहेसेस उसके अंदर सारे के

play11:35

सारे इनपुट हम पास कर देंगे यहां पर एक ही

play11:38

इनपुट है व्हिच इज नहीं उसको अपने पास कर

play11:40

दिया तो इतना सा रिकॉर्ड अपने नाम को

play11:42

प्रिंट करवाने का मेन फंक्शन के अंदर नाम

play11:44

को इनपुट लिया फंक्शन को कॉल किया तो यहां

play11:47

पर हमने कॉल किया

play11:51

ए फंक्शन को एंड यहां पर हमने अपना फंक्शन

play11:54

डिक्लेयर कर दिया जैसे कि हम यहां से कॉल

play11:56

मारेंगे हम पहुंच जाएंगे प्रिंट - फंक्शन

play11:58

के अंदर यहां पर नाम हमारा प्रिंट हो

play11:59

जाएगा और रिटेल कर देंगे वापस इसी मेन

play12:03

फंक्शन के अंदर अब इसको शेयर करते हैं और

play12:05

ऑन करते हैं

play12:07

मुकेश हमारा आया है उसमें सबसे पहले में

play12:09

नाम टाइप करना पड़ेगा तो नाम टाइप कर देते

play12:12

हैं और यह हमने इनपुट दिया नाम और वहीं हम

play12:15

हमारे लिए प्रिंट होकर वापस आ गया तो कुछ

play12:18

इस तरीके से हमारे फंक्शन हमारा नाम

play12:20

प्रिंट कर दिया एक को कर दिया और समझते

play12:22

हैं कि फंक्शन को यूज करने का मेमोरी पर

play12:24

क्या इंपैक्ट रहे थे जैसे ही हम फंक्शन

play12:26

बनाते हैं अपने कोड के अंदर तो मेरी में

play12:28

क्या काम होता है मान लेते हैं कि हमारा

play12:31

एक मेन फंक्शन था तो यहां पर लिखेंगे

play12:34

पब्लिक जो स्टैटिक

play12:36

अवॉइड मी अभी जो मेन फंक्शन था

play12:41

इसके अंदर कुछ कम हुआ और उसने कॉल किया था

play12:45

कि नए फंक्शन को और यहां पर हमारा पब्लिक

play12:49

state-wide कोई नया फंक्शन द अब सबसे पहले

play12:54

जितने भी पक्ष होते हैं वह सारे के सारे

play12:56

मेमोरी मिक्स्ड की फॉर्म में से होते हैं

play12:59

ताकि यानि जैसे अगर आपने घर पर जुए की

play13:02

तैयारी करते टाइम्स किताब है अगर रखी

play13:04

होंगी या फिर बोर्ड के एग्जाम के टाइम

play13:06

किताब अगर रखी होंगी तो किताबों को कैसे

play13:08

रहते हैं एक के ऊपर एक के ऊपर रखे हैं एक

play13:11

के ऊपर एक के ऊपर किसी भी चीज को रखने को

play13:13

हम स्टार्ट फॉर्मेशन कहते हैं क्या कहते

play13:15

हैं टेक फॉर्मेशन जैसे अगर आप लेटे रख रहे

play13:19

हैं सीधी तो आप एक के ऊपर एक के ऊपर एक के

play13:21

ऊपर प्लेटें लेफ्टिनेंट उसको भी हम प्लेट

play13:24

का सेट करेंगे बुक्स फ्रॉम उसका सेट

play13:26

करेंगे ऐसे सीड्स अगर आपके ऊपर रख लें तो

play13:29

इसको सीधी काटेंगे सेट यानी एक के ऊपर एक

play13:32

के ऊपर एक चीजों को रखना और मैरी के अंदर

play13:35

जब भी फंक्शन होते हैं वह स्टेप की फॉर्म

play13:38

में से होते हैं

play13:39

और स्टॉक में एक चीज के से होने को हम

play13:43

कहते हैं टैक्स फ्री है

play13:46

है तो जैसे ही मेन फंक्शन बनाने मेरी के

play13:49

अंदर तो सबसे पहला Step एक फ्रेम जो हमारा

play13:52

बनेगा वह बनेगा हमारे मेन फंक्शन का तो

play13:55

यहां पर मेमोरी का भी कुछ हिस्सा होगा जो

play13:58

एडवोकेट हो जाएगा हमारी मेन फंक्शन को

play14:00

इसके अंदर मैन फंक्शन के जितने भी हमारे

play14:03

वेरिएबल होंगे वह भी स्टोर हो रहे होंगे

play14:06

और जैसे ही मेन फंक्शन में कॉल लगाई होगी

play14:09

इस नए फंक्शन को तो क्या हुआ एक और

play14:13

स्टेफ्री मार गया होगा तो मेन फंक्शन ने

play14:15

इस को कॉल लगाई एक और स्टार्ट प्रेम बन

play14:18

गया किसके लिए हमारे न्यू फंक्शन के लिए

play14:20

अब न्यू फंक्शन के जितने भी वेरिएबल होंगे

play14:23

वह यहां पर स्टोर हो रहे होंगे और जैसे ही

play14:26

न्यू फंक्शन कोई वैल्यू रिटर्न कर देगा

play14:28

यानि न्यू फंक्शन ने कोई वैल्यू वापस मेन

play14:32

को रिटर्न कर दी तो न्यू फंक्शन मेमोरी से

play14:34

हट जाएगा और फिर मैं मेरी में बचेगा सिर्फ

play14:38

मेन फंक्शन और जैसे इन्फेक्शन खत्म हुआ तो

play14:41

मेन फंक्शन भी मेरी से हट जाएगा तो कुछ

play14:44

ऐसे तरीके से मेमोरी में काम होता है जब

play14:46

बॉक्स इसको बनाते हैं फंक्शंस होते हैं

play14:49

मिनिमम सेट की फॉर्म में और हर फंक्शन के

play14:51

डूबे रहे बल्कि होते हैं वह सारे के सारे

play14:53

लेबल्स उसी मेमोरी के हिस्से में उसी

play14:56

स्टेप प्रेम में स्टोर हो रहे होते तो

play14:58

जितने राधा फंक्शन बनाएंगे अपने कोड के

play15:00

अंदर उतना ज्यादा आपका मेमोरी का साहस

play15:03

भरता चला जाएगा जितने ज्यादा फंक्शन कुमार

play15:05

बब्बर कॉल करेंगे उतना ज्यादा आपका मेमोरी

play15:08

स्टेप जो है वह भरता चला जाएगा मेरी कैसे

play15:11

काम करती है जावा कि जब भी पिंप्वाइंट

play15:13

करते हैं फंक्शन से पॉइंट करते हैं बाकी

play15:14

चीज़ें डिफाइंड करते हैं वह मूंगफली के

play15:17

उसने सीख रहे होंगे क्योंकि मेमोरी कैसे

play15:19

काम करेगी उस पर हमारे क्लासेज और

play15:21

ऑब्जेक्ट कितने है किस तरीके से हैं उसका

play15:24

बहुत बड़ा इन फैक्ट है तो उसके अंदर हमारा

play15:26

सदन ऑब्जेक्ट सीखेंगे तब हम जरा अच्छे से

play15:29

समझ पाएंगे कि ज्यादा की मेमोरी के अलग रख

play15:31

पार्ट्स किस तरीके से काम करें पर हमने

play15:34

यहां पर डिस्कस कर लिया कि फंक्शंस

play15:37

ई-मेल के अंदर किस तरीके से काम कर रहे हो

play15:40

मैं तो मुझे तरीके से स्टार्ट की फॉर्म

play15:42

में से होते हैं अब कुछ क्वेश्चंस

play15:44

प्रैक्टिस करेंगे जिससे फंक्शंस के ऊपर

play15:46

हमारी कमांड जो है वह और ज्यादा फ्रॉम

play15:48

होगी अनजान अच्छे से समझ पाएंगे कि

play15:50

फंक्शंस काम कैसे करते हैं एक क्वेश्चन अ

play15:52

मेकअप चिंटू कार्टून नंबर्स एंड ड्यू टो

play15:54

10th में यूज़र से क्या करना है दो नंबर

play15:57

लेने तो सबसे पहले इनपुट कराते हैं जो

play16:00

नंबर इंटे इजी किल्ड एस सी डॉट टेंट

play16:06

तो इंट बी सी इज इक्वल टू ए

play16:11

और उसके बाद क्या करेंगे अपने पुराने

play16:13

फंक्शन को हटा लेते हैं और एक नया फंक्शन

play16:16

बनाते हैं नया फंक्शन का नाम हम लेंगे इसे

play16:20

रिटर्न टाइप हम देंगे इन क्योंकि इस बार

play16:22

यह दोनों का समर्थन करेगा दो नंबर का तो

play16:25

रिटर्न टाइपिंग और इसे नाम दे देते हैं

play16:27

कैलकुलेट

play16:28

सम कैलकुलेट कम के अंदर दो पैरामीटर आएंगे

play16:32

इंटे अपॉइंट बीच यानी दो पैरामीटर्स यह दो

play16:35

आरजू में इंच हमने लिया अब क्या करना है

play16:37

इनका समटाइम प्लेट करना है तो इंटरेस्ट हम

play16:40

इज इक्वल टू ए प्लस बी और रिटर्न कर देंगे

play16:43

इनका तम तो इस तरीके से संभोग एक इंटीरियर

play16:47

वालु है तो इस तरीके से हमने विटामिन कर

play16:49

दिया था हम अब यहां पर क्या करते हैं एक

play16:51

मेन फंक्शन के लिए सामने लेबल बनाते तो

play16:54

अभी जो हमने रिबन आता वह कैलकुलेट समय के

play16:56

लिए बना था अब मुझे शाम बनाएंगे वह मेन

play16:59

फंक्शन के लिए बनाएंगे इन टाइम इज इक्वल

play17:02

टू हमने कॉल किया था क्या कैलकुलेट

play17:05

समकालीन ग्रेट समय पास करेंगे और बीबी कि

play17:08

अंधेर भी को पास करने के बाद जो भी आउटपुट

play17:10

आएगा उसको हम इज इक्वल टू से स्टोर करा

play17:13

देंगे नए सामने एंड फिर इस स्तंभ को हम

play17:17

करवा देंगे प्रिंट

play17:19

और इसे शेयर करें अगर ऑन करें तो सबसे

play17:23

पहले पास करेंगे कोड को अपना एक फ्री पास

play17:27

करेंगे इस अपना बीच इस पॉइंट हमारे पास

play17:29

समृद्ध और होकर आया विषाक्त इसको थोड़ा

play17:33

अच्छे से समझे तो सम आफ टू नंबर्स

play17:38

मैं एक और बार ऐसे रन कर लेते हैं एंड इस

play17:41

बार पास कर रहे होंगे सिक्स एंड टू तो उस

play17:44

टाइम आफ टू नंबर्स एक हमारे पास रटन होकर

play17:47

आ गया तो कुछ इस तरीके से हम फंक्शन बना

play17:50

सकते हैं दो नंबर के सांप को कैलकुलेट

play17:53

करने के लिए अब यह जो आर यू मैडम ले रहे

play17:55

हैं अपने फंक्शन के अंदर इंटेंट भी

play17:58

स्प्रिंग एस्प्रिन भी इशारे डोरमेंट दो

play18:00

तरीके से पास होते हैं या तो यह बाय

play18:03

रेफ्रेंस पास हो सकते हैं या यह बाय

play18:04

वैल्यू पास हो सकते हैं इनके क्या मतलब है

play18:07

यह भी हम सीख रहे होंगे धीरे-धीरे जब हम

play18:09

एडवांस डाटा इसको पढ़ रहे होंगे क्योंकि

play18:11

एडवांस डाटा इज मीन बाय रेफ्रेंस चीज पास

play18:14

हो रहे होते तो बाय रेफ्रेंस का क्या मतलब

play18:16

होता है पास होने का क्या मतलब होता है वह

play18:18

में बाद में समझ आ रहा होगा तो अगर आपको

play18:20

आर्टिकल पढ़ रहे हो ऑनलाइन खुद से सीकर

play18:22

हैं और वहां पर ऐसी चीजें लिखी हुई है तो

play18:24

घबराने की बात नहीं आगे के लैटर्स में वह

play18:27

टॉपिक हम कवर करेंगे

play18:28

है तो अगले क्वेश्चन पर बढ़ते हैं अगला

play18:31

क्वेश्चन है कि मेकअप फंक्शन टो

play18:33

मल्टीप्लाई टू नंबर रिटर्न दो प्रोडक्ट

play18:36

सैम चीज करेंगे अपना एक फंक्शन बना लेंगे

play18:38

उस फंक्शन के अंदर आ रहे होंगे दो नंबर्स

play18:41

इन ठेर इन चीफ और रिटर्न हो रहा होगा क्या

play18:43

इनटू बीइंग

play18:46

अब इसके लिए कर लेते हैं और भी तो हमने

play18:48

पहले इनपुट ले लिया था इस बार नया फंक्शन

play18:51

बना लेते हैं इसको कर दे दे कान्वेंट

play18:54

पब्लिक स्टैटिक * कैलकुलेट

play19:00

यह प्रोडक्ट कैलकुलेट प्रोडक्ट के अंदर दो

play19:03

नंबर देंगे इंटरफेयर इन थे ईस्ट

play19:06

कि इस बार क्या करते हैं नया अवेलेबल नहीं

play19:08

डिफाइन करेंगे हम एक और Vivo तो कैलकुलेट

play19:11

कर ही सकते हैं डायरेक्टली इनटू बी इसी

play19:14

वॉल्यूम कम कर देंगे रिटर्न तो इस तरीके

play19:16

से डायरेक्टली किसी आलू को भी अमृत ऑन कर

play19:18

सकते हैं एक नया वेरी वेल डिफाइंड करने की

play19:20

जरूरत नहीं है इसे कर लेते हैं से यहां पर

play19:24

क्या करेंगे यहां पर भी डाइरैक्टली प्रिंट

play19:26

करवाएंगे नए भवन में स्टोन नहीं करवाएंगे

play19:28

यहां लिख देते हैं प्रोडक्ट

play19:31

और यहां पर कॉल कर देते हुए फंक्शन को

play19:34

प्रिंट स्टेटमेंट के अंदर तो नाम लिखने

play19:36

कैलकुलेट प्रोडक्ट्स इसके अंदर पास किया

play19:38

हमने एक और भी और जो भी प्रोडक्ट रिटर्न

play19:42

होकर आएगा तो यहां पर प्रिंट स्टेटमेंट के

play19:44

अंदर डाइरैक्टली प्रिंट हो जाएगा तो और

play19:47

इसको हमने कलियां से और इसको रन करें अगर

play19:50

तो एक बात करते हैं टू और भी पाठ करते हैं

play19:54

थ्री टू इनटू थ्री प्रोडक्ट टू

play19:56

नवंबर-दिसंबर वास करेक्ट इनपुट आ गया अब

play20:00

बात करेंगे अपने नेक्स्ट क्वेश्चन की तो

play20:02

नेक्स्ट क्वेश्चन फाइंड फैक्टोरियल आफ

play20:03

नंबर हम 1112 में पढ़ा करते थे कि

play20:06

फैक्टोरियल क्या होता है किसी भी नंबर एंड

play20:08

के लिए फैक्टोरियल होता है एंड मल्टीप्लाई

play20:11

बाय - बन मल्टीप्लाई बाय - टू मल्टीप्लाई

play20:15

बाय - ट्री एंड ऑन जब तक एंड डिक्रीज

play20:18

होते-होते भवन नहीं बन जाता बाय डिफॉल्ट

play20:21

जीरो फैक्टोरियल होता है उसकी वाली कौन

play20:23

होती है नेगेटिव नंबर्स के लिए है

play20:27

कि हम फैक्टोरियल नहीं निकालते डरावना

play20:32

फैक्टोरियल पर रिटर्न नंबर इसी तरीके से

play20:34

वन फैक्टोरियल अगर देखें तो वहीं होता है

play20:36

तू फैक्टोरियल देखे तो वह टू इनटू वन होता

play20:38

है यानी टू थ्री फैक्टोरियल देखें तो वह

play20:42

थ्री * * वंशवृक्ष होता है फैक्टोरियल

play20:46

सिमिलरली फॉर * * * * वन यानि हमारा विचार

play20:49

होता है एंड सिमिलरली फैक्टोरियल लेकर तो

play20:52

वह 512 फॉरेन टू थ्री * * वन इज इक्वल टू

play20:57

120 तो कुछ इस तरीके से हम अपने नंबर के

play21:00

टिटोरियल पर लेट कर रहे होंगे फैक्टोरियल

play21:02

कैसे कैलकुलेट करें हम उसी नंबर से लेकर

play21:05

वापस वन तक जा रहे हैं और उस नंबर को

play21:08

मल्टीप्लाई कर पा रहे हैं अब यहां पर हम

play21:11

समझ पा रहे होंगे कि एक काम जो है वह

play21:14

बार-बार हैं नंबर को मल्टीप्लाई करें

play21:16

बार-बार एक से डिक्रीज करके तो यहां पर हम

play21:19

हेल्प लेने वाले हैं लुक्स की तो उसके ऐसे

play21:22

किसी नंबर के फैक्टोरियल को टारगेट कर रहे

play21:24

होंगे तो सबसे पहले यह करते हैं इन लेते

play21:28

हैं एक नंबर इन इन 1052

play21:32

ssc.nic.in

play21:35

टैन इज इक्वल टू एसी डॉट नेक्स्ट9

play21:40

तो कमेंट नंबर ले लिया इनपुट अब इसे भी

play21:44

कमेंट कर देते हैं और अपना फंक्शन लिखते

play21:47

हैं टू कैलकुलेट फैक्टोरियल तो अब

play21:49

लिपस्टिक हमने वैसे के वैसे लिख दिया

play21:52

टिटोरियल जो है उसको रिटर्न नहीं भरा रहे

play21:55

हैं यहां पर उसको सिर्फ डाइरैक्टली प्रिंट

play21:57

करवा देंगे तो उसके लिए रिटर्न टाइप तो

play21:59

वहीं रख देते हैं और फंक्शन का नाम लिखते

play22:01

हैं प्रिंट फैक्टोरियल प्रिंस फैक्टोरियल

play22:05

के अंदर हमारे पास एक नंबर आएगा इंटीरियर

play22:07

एंड और हम क्या करेंगे अब एक लूप चलाएंगे

play22:09

तो लूट के अंदर एक फारुख चलाएंगे हमने

play22:13

क्या पैटर्न देखा कि फॉर लूप के अंदर

play22:16

हमारे जो आए हैं वह इन से लेकर

play22:19

वन तक जाए और आई - - को हर बार और हम उसे

play22:24

मल्टीप्लाई करें खुद के ही साथ तो यहां पर

play22:26

एक नया वियरेबल बना लेते हैं जो कैलकुलेट

play22:29

कर व फैक्टोरियल कोई निचला इस तरीके मान

play22:31

के साथ जिलों के साथ इलेक्टोरल को इन्हें

play22:34

सिलाई कर सकते थे लेकिन जीरो फैक्टोरियल

play22:36

भी बान होता है और जिलों को अगर किसी के

play22:38

साथ मल्टी लाइक कर दिया तो सारी लालू जरूर

play22:40

जाएं है इसलिए बाई डिफ़ॉल्ट शुरुआत में वन

play22:42

लेंगे एंड अब हम क्या करेंगे टिटोरियल को

play22:46

हर बार मल्टीप्लाई कर देंगे अपने आई से

play22:49

फैक्टोरियल * आए लास्ट में रिटर्न कर

play22:53

देंगे अब

play22:55

मैं अपनी फैक्टोरियल कि बालों को

play22:59

कि यहां पर रिटर्न नहीं कर रहे होंगे यहां

play23:01

पर प्रिंट करवा देंगे अपने टिटोरियल कि

play23:03

वॉल्यूम को

play23:05

अन यहां से कट जाएंगे रिटर्न अब एक खास

play23:08

बात यह कि फंक्शन के अंदर अगर आपका रिटेल

play23:10

प्राइस बिड है और आप रिटर्न नाम भी लिखें

play23:12

तो भी आप इस फंक्शन से रिटर्न हो सकते हैं

play23:15

बस वहीं फंक्शंस के लिए रिटर्न हम अभी तक

play23:17

इसलिए लिख रहे थे ताकि रिटर्न का मतलब

play23:19

क्लियर हो जाए अब देखेंगे तो मेन फंक्शन

play23:21

जो है उसका भी रिटर्न टाइट है और उसके

play23:24

अंदर कोई डिटेल्स स्टेटमेंट नहीं आती है

play23:25

निमित्त क्योंकि इसका वेट आइज वाइड कुछ

play23:27

रिप्लाई नहीं कर रहा लेकिन यहां पर इस

play23:30

फंक्शन 15 मिनट और लिक्विड लें तो भी कोई

play23:32

परेशानी नहीं आएगी तो अभी हम शुरुआती

play23:35

स्टेज में ठीक है तो टाइम लिखी देते हैं

play23:37

ताकि चीजें याद रखें कि रिटर्न भी करना

play23:39

होता है फंक्शन से तो वो इस फंक्शन का

play23:42

टाइट है प्रिंस फैक्टोरियल नाम है इन

play23:44

टियर्स अरे इसका आर यू मेंट है लूप चला

play23:46

लिया हमने शुरुआत की फैक्टोरियल लेकिन

play23:48

रियल के साथ जुबान से इन्हें सिलाई सैफ

play23:50

लूप में हम गए आई सीक्वेंस लेकर वन तक और

play23:53

आपको कर दिया - - मतलब डिक्रीज बाहर एक

play23:56

हाइड्रेशन के साथ अरे इस एप के साथ

play23:59

पेट्रोल को कुछ इस तरीके से हमने

play24:01

मल्टीप्लाई कर लिया एंड फैक्टोरियल को

play24:03

हमने प्रिंट करवा दिया अब यहां पर मैन

play24:05

फंक्शन के अंदर कॉल लगा लेते हैं प्रिंट

play24:07

फैक्टोरियल को जिसके अंदर पास कर देंगे

play24:10

अपना नंबर रहेगा कि अब इस कॉर्ड को रामनगर

play24:13

करें तो सबसे पहले फैक्टोरियल calculate

play24:16

करते हैं फ्री के लिए टिटोरियल आगे

play24:18

स्नैक्स दोबारा से अगर एक बार करें तो इस

play24:22

बार फैक्टोरियल calculate करते हैं 5 के

play24:25

लिए तो आगे हमारे पास 120 अब इसमें कंडीशन

play24:29

को लिखी नहीं अगर हमने कोई नेगिटिव नंबर

play24:31

दे दिया तो तो उसके लिए कंडीशन लिख लेते

play24:33

हैं इस एंड एब्सलूट 102 उस केस में आप

play24:38

प्रिंट करवाइए इन्वाइलेट

play24:42

फोन नंबर और यहां से अब आप आजाइए रिटर्न

play24:46

टो रिटर्न का यह फायदा है कोड के अंदर कि

play24:49

अगर आपको आखिर में विटामिन ई करना बीच में

play24:52

कहीं पर इंस्टॉल करना है तो आप बीच में भी

play24:54

जहां पर भी रिटन स्टेटमेंट लिखेंगे अपने

play24:56

फंक्शन के अंदर वह इसे आप रिटर्न कर रहे

play24:59

होंगे अगर हम नहीं इन रेफ्रेंस जीरो पांच

play25:02

कर दिया यानी यानी मान लीजिए कि हम इनको

play25:05

पास कर दे आज - 5th

play25:09

कि यहां पर इन वाले नंबर प्रिंट हो गया तो

play25:11

कुछ ऐसा हुआ होगा कि एंडलेस जरूर हुआ होगा

play25:13

फ्री हो इससे पेट मिनट के अंदर आया होगा

play25:16

इस ब्लॉक के अंदर आया होगा या इन वाले

play25:18

नंबर प्रिंट को यहां से डन कर गया इस वाले

play25:21

लूप में वह आया ही नहीं यह वाले काम घुसने

play25:24

के लिए ही नहीं तो जहां पर रिटर्न आएगा

play25:25

वहीं से डन कर जाएगा तो अपने बटन को बड़े

play25:28

ध्यान से लिखना अपने फंक्शन के अंदर कुछ

play25:30

इस तरीके से अपनी प्रिंट फैक्टोरियल

play25:32

फंक्शन को अपने कंप्लीट करवा लिया है नीचे

play25:35

डिस्क्रिप्शन बॉक्स के अंदर आपको यह

play25:36

चैप्टर नोट मिल रहे होंगे आए हो पास क्लास

play25:38

है इस प्रयोग को समझने में की फंक्शंस

play25:40

क्या होते हैं एक और लास्ट चीज हम डिस्कस

play25:43

कर लेते हैं कि इस फंक्शन और मैं थर्ड में

play25:45

क्या डिफरेंस होते हैं तो हम बार-बार कहते

play25:48

हैं कि फंक्शंस और मेथड पढ़ रहे होंगे

play25:50

फंक्शन पर मेथड दोनों ही एक क्लॉक ऑफ कोड

play25:53

होते हैं जो कोई ऑपरेशन परफॉर्म करते हैं

play25:56

इनपुट को लेते हैं और आउटपुट देते हैं पर

play26:00

छोटा सा डिफेंस के अंदर होता है कि मैं

play26:02

थर्ड इसको हम कॉल करते हैं क्लास के थे

play26:06

ऑब्जेक्ट्स के थ्रू एंड फंक्शंस को हम कॉल

play26:09

करते हैं डाइरैक्टली तो यहां पर

play26:12

अभियुक्तों से कोई नहीं ना हमने कोई

play26:14

ऑब्जेक्ट बनाई है तो यहां पर जितने भी

play26:16

फंक्शन लिखने उनको फंक्शंस जाएंगे लेकिन

play26:18

अगर किसी पॉइंट पर हम क्लास की ऑब्जेक्ट

play26:21

की हेल्प से किसी फंक्शन को कॉल करने हैं

play26:23

तो इसी सेम फंक्शन को हम मैं कट कर देते

play26:26

हैं बस इतना सा छोटा सा डिफरेंस है वह समझ

play26:28

लेंगे तो वह चीजें थोड़ी आसान रहेंगी

play26:30

इंटरव्यू में पूछ सकते हैं तो हमें पता

play26:32

होना चाहिए कि कल फंक्शन बोला जाएगा और कब

play26:35

मेथड बोला जाएगा आईएफ फंक्शन के बारे में

play26:37

चीजें पता चली जाऊंगी और नीचे जाकर

play26:39

होमवर्क प्रॉब्लम कम जरूर सॉल्व कर रहे हो

play26:41

खुद से प्रैक्टिस कर रहे हो आज के लिए

play26:44

इतना ही मिलते हैं नेक्स्ट वीडियो में

play26:45

चिल्ड्रन किड्स लर्निंग एंड कीप

play26:46

प्रैक्टिसिंग थे