Thursday, December 24, 2015

The String Constructor:

The String Constructor:
//Construct one String from other

class MakeString{
public Static void main(String[] args){

Char c[]={'d','o','g'};
String s1=new String(c);
String s2= new String(s1);

System.out.println(s1);
System.out.println(s2);
}

}
The output of this program is as follow:
dog
dog

0 comments:

Post a Comment