Hi y’all! It’s another day to practice the StringTokenizer with me!
You can check my last post out above, and let’s get this started!
Let’s say there is a game of the war. And this game records points with the “-”, “+” signs. When there is “-” in front of the number means the player got attacked, and “+” means the player attacked the others.
When there is a String msg that has player’s points, print each of the sum of points that they got and lost.
String msg = "+1/-1/-1/+2/+1/+1/+2/-3/+3";
I split the String with the StringTokenizer war…
Hi guys! Welcome to another day of practicing Java with me. Like I said on the last post, I brought some practice questions of StringTokenizer, so if you miss the last posts check them out before!
String sample = "A#whole/new#/World";
Hi guys! Today I’m going to talk more about the StringTokenizer and the while statement which is another loop. The first post about StringTokenizer is on below.
Last time I used countTokens() to count how many tokens are there in the StringTokenizer. There are different way to check if the StringTokenizer has tokens.
StringTokenizer — One of the Java util package that breaks a String into tokens.
Hi y’all! Today I’m going to show you how to use the StringTokenizer. It’s very similar with one of the String method split(), but you might find StringTokenizer more convenient to use.
Unlike the split() method, the StringTokenizer is a class, so you have to create it with the new operator.
Hey guys! I know I told you that I’m going to bring some practice questions today, but I think it’d be better If I show you some more of the methods that you can use on the ArrayList.
Checkout my last post before we go!
If we use the add() method like the last time, it will add the index at the end of the ArrayList, for instance,
ArrayList — Re-sizable array that java.util package provides.
Hi y’all! Today we’re going to take a look at the ArrayList. You would remember arrays, there are one dimensional and two dimensional arrays.
Basically all of them(one, two dimensional arrays, ArrayList) have the same purpose, which is storing elements.
ArrayList can be slower than the arrays sometimes, but it’s undeniably easier than that. You don’t have to fix its size when you declare it, and when you remove one of the index, it reorganize the array by itself! I’ll show you an example.
Hi guys! Today we’re going to practice the String methods that we’ve seen on the last posts. So before we go it’d be better to check them first.
String sample = "I'm going to school tomorrow.";
String answer = "";
The answer is on below!
Following from the last time, let’s see what kind of methods we can use on the String.
This method removes the spaces in the beginning and the end of the String. It doesn’t need parameter.
Hi y’all! In one of my old post I was talking about three String methods charAt(), equals(), length().
Today I’ll talk about more of the String methods that we can use often. Let’s get this started then!
This method returns true if the String starts with the parameter String, and returns false if it doesn’t.