Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Hibernate-Interview-Questions How ro convert char into string??
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Hardik Patel
How ro convert char into string??
2 Answer(s)      3 years and 10 months ago
Posted in : Hibernate Interview Questions


Suppose i have one array like... char [] ch={'H','E','L','L','o'};

now i want to convert this arrar into string using recursive function. Then how can i do it???


Advertisement
View Answers

January 28, 2011 at 12:16 PM


Hi Friend,

Try this:

import java.util.*;
class ConvertCharArrayToString 
{
    public static void main(String[] args) 
    {
        StringBuffer buffer=new StringBuffer();
        char [] ch={'H','E','L','L','O'};
        for(int i=0;i<ch.length;i++){
            buffer.append(ch[i]);
        }
        String str=buffer.toString();
        System.out.println(str);
    }
}

Thanks



January 28, 2011 at 10:43 PM


This coding is for java...but i want this in c#

How ro convert char into string using recursive function in c#?? char [] ch={'H','E','L','L','o'};

TO

ans = HELLO



Related Tutorials/Questions & Answers:
Advertisements
 

 

 

DMCA.com