String comparison using methods