Hi guys! So last time we made snake and snail shapes using by Two Dimensional Array. The link of the last session is on below.
And now let’s solve some more!
int[][] two = new int[5][5];
1 2 4 7 11
3 5 8 12 16
6 9 13 17 20
10 14 18 21 23
15 19 22 24 25
Hi guys! Following the last post, today we’re going to practice the Two Dimensional Array! There’s a link of the last session below.
It’s always better when you solve the questions by yourself!
int[][] two = new int[5][5];
25 24 23 22 21
16 17 18 19 20
15 14 13 12 11
6 7 8 9 10
5 4 3 2 1
So the numbers go like this,
Hi y’all! Welcome to another Java session with me, and today I’m going to talk about the Two Dimensional Array. This is not that different with the one dimensional array, only difference between them, is that the two dimensional array is just a array of the one dimensional array! So before we go, it’d be better if you check out my post about one dimensional array.
So to declare the two dimensional array is not that difficult. You can just put one more set of brackets in the one dimensional array declaration, like below.
Hi guys! I know last time I told you that I’m going to talk about the two dimensional array this time, but I thought it’d be better to know the concept of the whole increment/decrement operator first, before we go too far. So let’s get this started! And don’t forget to checkout my old post about the operators!
Like I said in my old post, there are unary operator, which look like a++
, a--
, ++a
, --a
. But last time I told you both a++
and ++a
mean a=a+1
, also a--
, --a
mean a=a-1
. …
Hi guys! It’s another String method practice today! Don’t forget to checkout my last posts below.
You can only use length()
, charAt()
, equals()
method just like the last practice. Let’s do this!
String quote = "Whether you think you can or can't, you're right.";**The sample of the result on the console**
______________________can____can_________________
It’s a very famous quote by Henry Ford, and that is true. Think you can do anything! Yay! The answer is on below.
Hi guys! It’s a practice session today so if you missed my last post, check the link below!
So like I said last time, we only can use the method charAt()
, length()
, equals()
for today’s questions.
String str = "Life is a long lesson in humility."
Let’s print the numbers of index that have ‘i’ as value too if you could. Here the ‘i’s data type is char, so you can compare them with the comparison operator ==
. The answer is right on below, but try to solve this by yourself!
Method — A block of code that performs specific task.
Hi guys! Welcome to another Java session with me. Today I’m going to talk about the methods that we can use on String in java. Let’s get this started!
I’m going to talk about method deeply in the future session, so for now all we need to know is how it works. Method is a block of code that performs specific task, followed by parentheses()
. In the parentheses, we can put parameter
which is a passed information. Some method need parameter, but some don’t. …
Hello! Last time we made a lotto number generator, today let’s make an improved lotto program! If you missed the last post, checkout the link below.
I’ll give you a big hint here. This time let’s use the index as the number 1 to 52, and use the for statement pick the random numbers 1000 times and when every time the random number coming out then add 1 on the index that is same with the random number!
Hi y’all! Like I said last time, today let’s generate the lottery program. If you missed the first Array & Random Practice, the link is right on below!
Try to solve it by yourself, and the answer is on below!
Hi guys! Welcome to another java exercise with me! Today let’s practice some more on array. If you missed the basic array sesh, check out my old post below!
int[] a = {1, 2, 3, 4, 5, 6, 7};
I know it’s way easier to count the numbers with your brain, but imagine when there are more than thousand random numbers and you have to count the even numbers in those by your hands and eyes…Let’s build this program for that. The answer is on below, and you know the drill!