Computer Science, asked by ensha47, 8 months ago

b) char chars[] = {a', 'b', 'c}
String sl = new String(chars);
20
String s2 = new String(s1);
System.out.println(s 1);
System.out.println(s2);​

Answers

Answered by Oreki
2

Snippet:

    char[ ] chars = {'a', 'b', 'c'};

       chars ==> char[3] { 'a', 'b', 'c' }

    String s1 = new String(chars);

        s1 ==> "abc"

    String s2 = new String(s1);

        s2 ==> "abc"

    System.out.print(s1);

System.out.print(s2);

Output:

abc

abc

Similar questions