Posts

Recent posts

16 Java Fundamentals | Multidimensional Arrays in Java | By Dummy for Dummies

Image
  INTRODUCTION: Hey guys welcome back! Remember we made variable of variables? And called it Arrays? Today we are gonna talk about we can even make Array of Arrays, they are called multidimensional Arrays. Think of a 2D array as an array that contain arrays: ⦿  2D Array  →  Contains Arrays  →  Contains variables/data And a 3D array as, array that contain arrays, each of those array contain more arrays. ⦿  3D Array  →  Contains 2D Arrays  →  Contains Arrays  →  Contains variables/data And so on... 2D ARRAYS   Imagine a classroom full of chairs. It does not contain a single line of chairs (1D Array) but rather rows and columns of chairs. Where: ⦿  Row = Line of chair ⦿  Column = Specific chair in that row So to point a specific chair you'd say "Row 3, column 2". That is how exactly you can access data in 2D Arrays. Let's first write the java magical spell for creation of 2D Array       ...

15 Java Fundamentals | Arrays in Java | By Dummy for Dummies

Image
INTRODUCTION   Imagine you have money, you put the money in a wallet. It is like putting data in a variable. Now if you have a lot of wallets (definitely not stolen), and you put them all in a bag. That will be like putting all variables in another variable. That is exactly what Arrays are, variable of variables ARRAYS   In array the all the data you store must have same datatype. Here is the magical spell to create an array:                 int[] numbers = new int[5];    Let's break down the java spell into our human language...  int    →  It tells the program about the datatype of array we want to create. Just like we did in making of simple variables.  []    →  It tells the program that the datatype is actually Array of Integers  rather than just variable of integer.  new int[5]    →  Think of it as just another magical spell you don't need to explore...

14 Java Fundamentals | Recursion in Java | By Dummy for Dummies

Image
  INTRODUCTION Imagine you want to make a method that has to do a complex task which cannot be done in a single call. In that case, you can break the task into smaller parts: the method will do a small portion, then call itself again to handle the next part, and so on, until the desired result is reached RECURSION A recursive method is more like a loop. It will call itself and repeat the same process. We will manually set some conditions for when to stop this whole process, and what to pass as arguments when the method call itself again. Base Case. Base case is the most important part of recursive method.It is the condition which will decide when to stop the process. Without this the recursive method will keep on calling itself until the program CRASHES! It consists of a single if condition which when comes true the recursion will stop Correct Call We will set the call inside the method itself, and set the arguments in such way that each time it call itself it sends updated data ...