String & Array String. methods

PHOTO EMBED

Wed Apr 21 2021 23:00:35 GMT+0000 (Coordinated Universal Time)

Saved by @ahmedqgqgq #java

public class Amazon {
    public static void main(String[] args) {
        String str = "ABCD";
        System.out.println(str);
    }
}
public class Amazon {

    public static void main(String[] args) {
        String str = new String("ABCD");
        System.out.println(str);
    }
}
public class Amazon {

    public static void main(String[] args) {
        String str = new String("ABCD");
        System.out.println(str);
        //class methods
    }
}
public class Amazon {
    public static void main(String[] args) {
        String str = "Hello";
        str = str.concat(str);
        System.out.println(str);
    }
}
public class Amazon {
    public static void main(String[] args) {
        String str = "Hello";
        str = str.concat(", I'm Ahmed");
        System.out.println(str);
    }
}
public class Amazon {
    public static void main(String[] args) {
        String str = "Hello";
        str = str + ", I'm Ahmed";
        System.out.println(str);
    }
}
public class Amazon {
    public static void main(String[] args) {
        String str = "Hello";
        str = str + ", I'm Ahmed";
        System.out.println(str);
    }
}
public class Amazon {
    public static void main(String[] args) {
        String str1 = "Hello";//have same address
        String str2 = "Hello";//have same address
        System.out.println(str1);
        System.out.println(str2);
    }
}
public class Amazon {
    public static void main(String[] args) {
        String str1 = "Hello";// have same address
        String str2 = "Hello";// have same address
        String str3 = "AAAAA";
        str1 = "12345";
        System.out.println(str1);
        System.out.println(str2);
        // System.out.println(str3);
    }
}
public class Amazon {
    public static void main(String[] args) {
        String str1 = "Hello";// have same address
        String str2 = "Hello";// have same address
        String str3 = "AAAAA";
        str1 = "12345";
        System.out.println(str1);
        System.out.println(str2);
        // System.out.println(str3);
    }
}
public class Amazon {
    public static void main(String[] args) {
        String str1 = "Hello";// have same address
        String str2 = "Hello";// have same address
        String str3 = "AAAAA";
        str1 = "12345";
        System.out.println(str1);
        System.out.println(str2);
        // System.out.println(str3);
    }
}
public class Amazon {
    public static void main(String[] args) {
        String s1 = "ABCD";
        String s2 = "ABCe";
        System.out.println(s1.compareTo(s2));
    }
}
public class Amazon {
    public static void main(String[] args) {
        String s1 = "ABCD";
        String s2 = "ABCe";
        System.out.println(s1.compareTo(s2));
        /*
         * s1>s2=+num, s1<s2=-num, s1=s2=0
         */
    }
}
public class Amazon {
    public static void main(String[] args) {
        String s1 = "ABCD";
        String s2 = "ABCe";
        System.out.println(s1.compareTo(s2));
        /*
         * s1>s2=+num, s1<s2=-num, s1=s2=0
         */
       System.out.println((int) 'A' + (int) 'B' + (int) 'C' + (int) 'D');
       System.out.println((int) 'A' + (int) 'B' + (int) 'C' + (int) 'e');
    }
}
public class Amazon {
    public static void main(String[] args) {
        String s1 = "ABCD";
        String s2 = "ABCe";
        System.out.println(s1.compareTo(s2));
        System.out.println((int) 'D');
        System.out.println((int) 'e');
        /*
         * s1>s2=+num, s1<s2=-num, s1=s2=0
         */
    }
}
public class Amazon {
    public static void main(String[] args) {
        String s1 = "ABCe";
        String s2 = "ABCe";
        System.out.println(s1.compareTo(s2));

    }
}
public class Amazon {
    public static void main(String[] args) {
        String str1 = "   hello   ";
        System.out.println(str1 + "how are you");
    }
}
public class Amazon {
    public static void main(String[] args) {
        String str1 = "   hello   ";
        System.out.println(str1.trim() + "how are you");
    }
}
public class Amazon {
    public static void main(String[] args) {
        String str1 = "   hello   ";
        System.out.println(str1.trim() + "how are you");
    }
}
public class Amazon {
    public static void main(String[] args) {
        String str1 = "HEllo I'm Belal";
        System.out.println(str1.toLowerCase());
    }
}
public class Amazon {
    public static void main(String[] args) {
        String str1 = "HEllo I'm Belal";
        System.out.println(str1.toLowerCase());
    }
}
public class Amazon {
    public static void main(String[] args) {
        String str1 = "HEllo I'm Belal";
        System.out.println(str1.toLowerCase());
    }
}
public class Amazon {
    public static void main(String[] args) {
        int n = 10;
        String str1 = String.valueOf(n);
        System.out.println(str1);
    }
}
public class Amazon {
    public static void main(String[] args) {
        int n = 10;
        String str1 = n + "";
        System.out.println(str1);
    }
}
public class Amazon {
    public static void main(String[] args) {
        String s1 = "HELLO";
        String s2 = "HELLO";
        System.out.println(s1 == s2);
    }
}
public class Amazon {
    public static void main(String[] args) {
        String s1 = "HELLO";
        String s2 = "HELLO";
        System.out.println(s1 == s2);
    }
}
public class Amazon {
    public static void main(String[] args) {
        String s1 = new String("HELLO");
        String s2 = new String("HELLO");
        System.out.println(s1 == s2);
    }
}
public class Amazon {
    public static void main(String[] args) {
        String s1 = new String("HELLO");
        String s2 = new String("HELLO");
        System.out.println(s1 == s2);//address
    }
}
public class Amazon {
    public static void main(String[] args) {
        String s1 = new String("HELLO");
        String s2 = new String("HELLO");
        System.out.println(s1.equals(s2));//address
    }
}
public class Amazon {
    public static void main(String[] args) {
        String s1 = new String("HELLO");
        String s2 = new String("HELLO");
        System.out.println(s1.equals(s2));
    }
}
public class Amazon {
    public static void main(String[] args) {
        String s1 = new String("HELLO");
        String s2 = new String("HELLO");
        s1 = s2;
        System.out.println(s1 == s2);
    }
}
public class Amazon {
    public static void main(String[] args) {
        String s1 = new String("HELLO");
        String s2 = new String("HELLO");
        s1 = s2;
        System.out.println(s1 == s2);
    }
}
public class Amazon {
    public static void main(String[] args) {
        String s1 = "HELLO";
        String s2 = "hello";
        System.out.println(s1.equalsIgnoreCase(s2));
    }
}
public class Amazon {

    public static void main(String[] args) {
        String s1 = "HELLO";
        String s2 = "hello";
        System.out.println(s1.equalsIgnoreCase(s2));
    }
}
public class Amazon {
    public static void main(String[] args) {
        String s1="Hey, Welcome to c++ course";
        String replaceString=s1.replace(target, replacement)
    }
}
public class Amazon {
    public static void main(String[] args) {
        String s1 = "Hey, Welcome to c++ course";
        String replaceString = s1.replace("c++", "JAVA");
        System.out.println(replaceString);
    }
}
public class Amazon {
    public static void main(String[] args) {
        String s1 = "Hey, Welcome to c++ course";
        String replaceString = s1.replace("c++", "JAVA");
        System.out.println(replaceString);
    }
}
public class Amazon {
    public static void main(String[] args) {
        String s1 = "Hey, Welcome to c++ course c++";
        String replaceString = s1.replace("c++", "JAVA");
        System.out.println(replaceString);
    }
}
public class Amazon {
    public static void main(String[] args) {
        String name="hello how are you doing";
        System.out.println(name.contains("how are you"));
        System.out.println(name.contains("hello"));
        System.out.println(name.contains("fine"));
    }
}
public class Amazon {
    public static void main(String[] args) {
        String name = "hello how are you doing";
        System.out.println(name.contains("how are you"));
        System.out.println(name.contains("hello"));
        System.out.println(name.contains("fine"));
    }
}
public class Amazon {
    public static void main(String[] args) {
        String name = "hello how are you doing";
        System.out.println(name.contains(" you"));
        System.out.println(name.contains("hello"));
        System.out.println(name.contains("fine"));
    }
}
public class Amazon {
    public static void main(String[] args) {
        String s1 = "hello how are you";
        System.out.println(s1.endsWith("u"));
        System.out.println(s1.endsWith("you"));
        System.out.println(s1.endsWith("how"));
    }
}
public class Amazon {
    public static void main(String[] args) {
        String s1 = "hello how are you";
        System.out.println(s1.endsWith("u"));
        System.out.println(s1.endsWith("you"));
        System.out.println(s1.endsWith("how"));
    }
}
public class Amazon {
    public static void main(String[] args) {
        String ahmed1 = "Ahmed Abdelmoneim";
        System.out.println(ahmed1.substring(0));
    }
}
public class Amazon {
    public static void main(String[] args) {
        String ahmed1 = "Ahmed Abdelmoneim";
        System.out.println(ahmed1.substring(2));
    }
}
public class Amazon {
    public static void main(String[] args) {
        String ahmed1 = "Ahmed Abdelmoneim";
        System.out.println(ahmed1.substring(2, 8));
    }
}
public class Amazon {
    public static void main(String[] args) {
        String str = "AA-BB-CC-DD-EE-FF";
        for (String val : str.split("-")) {
            System.out.println(val);
        }
        ;
    }
}
public class Amazon {
    public static void main(String[] args) {
        String str = "AA BB CC DD EE FF";
        for (String val : str.split(" ")) {
            System.out.println(val);
        }
    }
}




















content_copyCOPY