1. Comments

    ⇒ Used to add notes in Java code

    ⇒ Not displayed on the web page

    ⇒ Helpful for code organization

    → Syntax:

    → Single Line: //

    → Multi Line: /* */

    → Java Docs: /** */

  2. What is Loop ?

    ⇒ Code that runs multiple times based on a condition.

    ⇒ Repeated execution of code.

    ⇒ Loops automate repetitive tasks.

    ⇒ Types of Loops: while, for, while, do-while.

    ⇒ Iterations: Number of times the loop runs.

  3. While Loop

    ⇒ Iterations

    → Number of times the loop runs.

    ⇒ Used for non-standard conditions.

    ⇒ Repeating a block of code while a condition is true.

    ⇒ Remember: Always include an update to avoid infinite loops.

    while (condition)
    	// statement...
    }
    
  4. Methods

    ⇒ Definition

    → Blocks of reusable code.

    ⇒ DRY Principle

    → "Don't Repeat Yourself" it Encourages code reusability.

    ⇒ Usage

    →Organizes code and performs specific tasks.

    ⇒ Naming Rules

    → Same as variable names: camelCase

    ⇒ Example

    → ”Beta Gas band kar de"

  5. Method Syntax

    ⇒ Follows same rules as variable names.

    → Use () to contain parameters.

    → Invoke by using the function name followed by ().

    → Fundamental for code organization and reusability.

  6. Return statement

    ⇒ Sends a value back from a function.

    ⇒ Example: "Ek glass paani laao"

    ⇒ What Can Be Returned: Value, variable, calculation, etc.

    ⇒ Return ends the function immediately.

    ⇒ Function calls make code jump around.

    ⇒ Prefer returning values over using global variables.

  7. Arguments

    ⇒ Input values that a function takes.

    ⇒ Parameters put value into function, while return gets value out.

    ⇒ Example: "Ek packet dahi laao”

    ⇒ Naming Convention: Same as variable names.

    ⇒ Parameter vs Argument

    ⇒ Examples: System.out.print, Scanner.nextInt(), are functions we have already used

    ⇒ Multiple Parameters: Functions can take more than one.

    ⇒ Default Value: Can set a default value for a parameter.

  8. Arrays

    ⇒ An Array is just a list of values.

    ⇒ Index: Starts with 0.

    ⇒ Arrays are used for storing multiple values in a single variable.

  9. Array Syntax

    ⇒ Use {} to create a new array, {} brackets enclose list of values

    ⇒ Arrays can be saved to a variable.

    ⇒ Accessing Values: Use [] with index.

    ⇒ Syntax Rules

    → Brackets start and end the array. → Values separated by commas. → Can span multiple lines.

  10. 2D Arrays