"Learned Java Functions and Methods on Day 7 of DSA"

💻 DSA – Day 7: Functions & Methods (Java) Today was all about understanding how functions make code cleaner, reusable, and easier to manage. I explored both the fundamentals and some powerful concepts used in real-world programming. ✅ What I learned today 🔹 Introduction to Functions Why we use them and how they help in breaking problems into smaller pieces. 🔹 Function Syntax + Code Demo Writing basic methods and calling them inside main(). 🔹 Parameters vs. Arguments Understanding how data flows into functions. 🔹 What happens in memory? (Call Stack) How Java manages method calls internally. 🔹 Call by Value (in Java) Java always creates a copy of variables when passing them to methods. 🧮 Problems I solved using Functions ✔ Product of two numbers ✔ Finding Factorial ✔ Binomial Coefficient ✔ Check if a number is Prime ✔ Optimized Prime Check ✔ Print all Primes in a Range ✔ Binary → Decimal (with code) ✔ Decimal → Binary (with code) These problems helped me apply concept + logic simultaneously. 🔄 Inbuilt vs User-Defined Methods Learning when to use Java’s built-in methods and when writing your own is better. ➕ Function Overloading Same function name, different parameters → cleaner and flexible code. Explored: Overloading using different parameters Overloading using different data types 📌 Scope in Java Understanding where variables can be accessed: Method Scope Block Scope This helps avoid errors and write structured code. 🚀 Small progress daily = Big progress later Enjoying how each concept connects to the next. Tomorrow I’ll continue leveling up step by step. #DSA #Day7 #Java #Functions #Methods #CodingJourney #100DaysOfCode #LearningInPublic #BCA #ProblemSolving

To view or add a comment, sign in

Explore content categories