150k views
0 votes
Write o/p of the code :


\:

class String_demo{
public static void main (String args[]){
char chars[]={'a','b','c'};
String s = new String(chars);
System.out.println(s);
}

}


\:
thanks ​

User General
by
8.0k points

1 Answer

4 votes

answer

below is the o/p from code:

the code declares a class string_demo and defines the main method in it.

within the main method, a character array chars is defined with values 'a', 'b', and 'c'

a string object 's' is created using the character array 'chars' with the help of the string constructor

finally, the string 's' is printed to the console using the println() method of the system class

then the output of the code will be abc

User Sbk
by
8.8k points