package ru.mai.dep806.memory;

/**
 * Created by stud on 19.02.2015.
 */
public class stringexample {
    public static void main(String[] args) {
        // String s = new String("abc");
        String a1 = new String("abc");
        String a2 = "abc";

        // System.out.println(a1 == a2);
        System.out.println(a1.equals(a2));

        /* String s1 = "Hello";
        String s2 = "world";
        String s5 = s1.concat(s2);  // конкатенация строк
        String s3 = s1 + s2;        // конкатенация вариант 2
        System.out.println(s5);
        System.out.println(s3);*/
        String s4 = "";

        for(int i = 1; i < 1000; ++i){
            s4 += String.valueOf(i);
        }
        System.out.println(s4);

        StringBuilder sb = new StringBuilder();
        for(int i = 0; i < 100000; i++){
            sb.append(i).append(",");
        }

        System.out.println(sb.toString());
        System.out.println(sb.length());

    }
}
