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



Home Answers Viewqa Java-Beginners java beginners doubt!
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Anusha B
java beginners doubt!
1 Answer(s)      3 years and 3 months ago
Posted in : Java Beginners


How to write clone()in java strings?


Advertisement
View Answers

June 18, 2011 at 12:06 PM


class StringClone{
    public static void main(String[] args) 
    {
String [] fruits ={"Apple","Mango","Grapes","Banana","Guava"};
  String [] fruits2 = (String []) fruits.clone ();
for (int i = 0; i < fruits.length; i++){
     fruits2 [i] = new String (fruits [i]);
     System.out.println(fruits2[i]);
    }

    }
}


Related Tutorials/Questions & Answers:
Advertisements
 

 

 

DMCA.com