My 15th Day at JSpider: Exploring Java Methods, Parameters, and Recursion | The Z Blogs | 07/03/2025
My Day at JSpider: March 7th, 2025
Today was my 15th day at JSpider, and it was a packed day filled with learning, personal moments, and some reflection. I woke up around 3:30 to 4:00 AM, took a shower, and then had my saheri (pre-dawn meal). After offering my Namaz, I took a quick nap until around 7:30 AM. When I woke up, I got ready for the institute and started heading out. On my way, I checked my phone and saw a message from my friends asking if I was coming today. I replied that I was on my way, and soon after, I reached the institute, punched in my attendance, and settled into my seat in class.
The class began, and the instructor started explaining functions with parameters in Java. He walked us through several examples, explaining the method declaration, method body, and various types of methods. He gave us detailed notes on the theory, and soon after, the class was over.
After the class, everyone went for breakfast. Rishika seemed upset due to some issues with others, so she stood away from the group. I took some time to console her, which felt good. Then we headed to the practice session where we worked on the programs we had received the day before. We spent some time writing mathematical functions that calculated areas for different geometrical shapes. It was a challenging but fun task.
After the session, we had a 15-minute break, so Rishika and I decided to go to the park for a few minutes to relax. We returned to the classroom after a short while and waited for the instructor to start the next session. This time, the instructor dove into methods with arrays and gave us various interview questions on methods, explaining different scenarios of using parameters in Java. This session was also packed with useful information.
Once the class ended, it was lunchtime. I decided to head home and was joined by some of my friends. After reaching home, I went to the masjid to offer Jauhar Namaz and then had a nap. Once I woke up, I returned to the class, where two of my friends were already waiting. The class began with two exercises on methods, parameters, and recursion. I managed to solve both, though there were a few mistakes I corrected along the way. The instructor told us that tomorrow would be focused on Java libraries, and there would be no practice session.
After the class, I went to the other building where my friends’ bikes were parked. I asked one of them to drop me at my PG, and he kindly agreed. During the ride, he shared some of the challenges he was going through, and I helped calm him down. By the time we reached my PG, it was around 5:30 PM.
I went up to my room, dropped off my bag, locked the door, and headed to the masjid. On my way, I saw a haleem stall, so I stopped to buy some. I had missed eating it the last time, so I made sure to buy it today. I kept the haleem in a grocery store nearby and promised to pick it up after the namaz. I performed Wuzu (ablution) and offered Asr Namaz, then waited for Maghrib (sunset) to arrive.

When the time for Iftar came, I went upstairs where an uncle was distributing almonds. Afterward, I grabbed a glass of Roohafza, found a place to sit, and had my Iftar. I also offered Maghrib Namaz before heading back to my PG. On my way back, I passed by an ice cream stall, and I couldn’t resist getting a Badam Shake with ice cream. It tasted amazing! I was tempted to get another one, but I decided against it because of the sugar content and the fact that I had to pay for it.
Back in my PG, I spent about 15-20 minutes on social media. I was also expecting a parcel that had been marked out for delivery. However, I didn’t have contact information for the delivery guy, and I didn’t want him to deliver the parcel while I was at the masjid. I went to the masjid anyway, hoping it would be delivered after I returned. But when I got back, the parcel still hadn’t arrived.
Then, I received a call from the delivery guy saying he was outside the gate. I went downstairs to check, but he wasn't there. However, an uncle called me from behind and told me that my parcel was waiting for me. I quickly grabbed it, went up to my room, and unpacked it. I then placed the box in my luggage.
Later, I took my tiffin and went to the dining area. I filled it with dinner and placed it in the refrigerator. Once I returned to my room, I did some pending work for the institute before finally sitting down to write this blog.
And that’s it for today! It was a busy but productive day, full of learning and personal moments. I’m looking forward to tomorrow’s class on Java libraries. Catch you up tomorrow! Bye!
Java Concepts and Study Material: Methods, Parameters, Recursion, and More
Now, let’s dive into the Java concepts that I learned today in class. This section will give a deeper explanation of the Java methods, parameters, and recursion concepts that were discussed.
1. Methods in Java
A method is a block of code that performs a specific task. It’s one of the fundamental building blocks of any Java program, enabling us to break our code into smaller, manageable chunks. In Java, a method has a few key components:
- Method Declaration: The declaration consists of the method’s return type, name, and parameters (if any). javaCopy
returnType methodName(parameters) { // Method body }
returnType
: The type of value the method will return. If a method does not return anything, it is defined asvoid
.methodName
: The name of the method. It should be descriptive, following Java naming conventions.parameters
: These are the values the method accepts to process. They can be of any data type.
Example of a method that adds two numbers:
javaCopypublic int add(int a, int b) {
return a + b;}
2. Methods with and without Parameters
- Method with Parameters: Methods can accept parameters (values or variables) passed when the method is called. These values are used within the method for processing. javaCopy
public int multiply(int a, int b) { return a * b; }
- Method without Parameters: Some methods don’t need parameters, and they can simply perform a task. javaCopy
public void printHello() { System.out.println("Hello, World!"); }
3. Recursion in Java
A recursive method is one that calls itself to solve a problem. Recursion is often used to solve problems that can be broken down into smaller subproblems of the same type. A classic example of recursion is calculating the factorial of a number:
javaCopypublic int factorial(int n) {
if (n == 0) {return 1;}return n * factorial(n - 1); // Recursive call}
In the example above, the method calls itself with a smaller value until it reaches the base case (n == 0
), at which point it stops.
4. Method Overloading
Java allows you to overload methods, meaning you can define multiple methods with the same name, but with different parameter types or numbers. This makes the code more flexible and efficient.
javaCopypublic int add(int a, int b) {
return a + b;}public double add(double a, double b) {return a + b;}
In the above example, the method add()
is overloaded with two different parameter types: one for int
and one for double
.
5. Static vs. Instance Methods
- Static Methods: These belong to the class and can be called without creating an object. Static methods are often used for utility functions that don’t require access to instance variables. javaCopy
public static void displayMessage() { System.out.println("This is a static method."); }
- Instance Methods: These belong to an object, so you must create an instance of the class to call them. javaCopy
public void instanceMethod() { System.out.println("This is an instance method."); }
6. Calling Methods in Java
To call a method, you simply use the method’s name followed by parentheses. If the method requires parameters, you need to pass them inside the parentheses.
javaCopyint result = add(5, 10); // Calls the add method with arguments 5 and 10
If the method is static, you can call it using the class name:
javaCopyMyClass.displayMessage(); // Calls the static method displayMessage from MyClass
Conclusion
Today was another great day at JSpider! I’ve learned a lot about Java methods, parameters, recursion, and method overloading. The real-world application of these concepts will definitely help me in my future projects and in interviews. Looking forward to learning more about Java libraries tomorrow! Catch you later!
Comments
Post a Comment