These tasks are hopeless, I don't know what is wrong or how to fix it.
package com.codegym.task.task22.task2212;
/*
Phone number verification
*/
public class Solution {
public static boolean checkPhoneNumber(String phoneNumber)
{
boolean flag = false;
if(phoneNumber.matches("^+[0-9]{12}"))
{
flag = true;
}
if(phoneNumber.matches("^[0-9]|^[(][0-9]{10}"))
{
flag = true;
}
if(phoneNumber.matches("'-'{1}'-'{1}"))
{
flag = true;
}
if(phoneNumber.matches("[()]'-'"))
{
flag = true;
}
if(phoneNumber.matches("[(]\\d{3}[)]"))
{
flag = true;
}
if(phoneNumber.matches("![a-zB-z]"))
{
flag = true;
}
if(phoneNumber.matches("[0-9]$"))
{
flag = true;
}
return flag;
}
public static void main(String[] args) {
}
}