Do you mean something like this?
if(s1.substring(p1).equals(s2.substring(p2))){
return true;
}
Originally, I want to do something like...
Type: Posts; User: javabro
Do you mean something like this?
if(s1.substring(p1).equals(s2.substring(p2))){
return true;
}
Originally, I want to do something like...
The first for loop is to get the total length of s1 and the second for loop is to get the total length of s2. I'm doing these to get the last index of the strings.
I realised I can actually do...
If you're referring to compare two strings with the same last 4 letters, then yes, equals method does work.
public class compareLast4
{
public static void main(String[] args){
...
I've tried the equals method and it doesn't work.
The one I've created works because I'm comparing numbers using the .length().
Hi!
I'm quite new to Java and I've got this question that requires me to solve a basic algorithm.
"Implement a method public static boolean compareLast4(String s1, String s2) that returns true...