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



Home Answers Viewqa Java-Interview-Questions Manoj Sahu,CITE,Bangalore
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Manoj kumar
Manoj Sahu,CITE,Bangalore
0 Answer(s)      3 years and 11 months ago
Posted in : Java Interview Questions


Hi dear 
I have a problem, please solve it,please give me solution within 1-2 days.I am a Student,MCA. ie I want to pass a list to a method and within method definition i removed the duplicate elements and when i returned the list to the calling method.when i compiled the code ,an  errors occurs that is:
 removeDuplicateFromArraListByMethod.java:21:<identifier> expected public String showNonDuplicateElements(list1)
---------------Below is my code, I tried---------------------

import java.util.*;
public class removeDuplicateFromArraListByMethod 
{
public static void main(String args[]) throws Exception
{
        nonDuplicateFound  ob=new nonDuplicateFound();
        ArrayList<String>list=new ArrayList<String>();
        list.add("A");
        list.add("A");
        list.add("A");
        list.add("B");
        list.add("B");
        list.add("C");

      ArrayList list3= ob.showNonDuplicateElements(list); 
        for(Object item:List3)
        System.out.println(item);
 }
 }   class nonDuplicateFound
      {
          public String showNonDuplicateElements(list1)
          {
        HashSet set=new HashSet(list1);

        ArrayList newList=new ArrayList(set);

        Collections.sort(newList);
        return newList;
        }
}   
 kindly solve my problem and send to <m.kumara.mca@gmail.com>
                             Thanks & Regards
                                Manoj

Advertisement
View Answers

Related Tutorials/Questions & Answers:
Manoj Sahu,CITE,Bangalore
Manoj Sahu,CITE,Bangalore   Hi dear I have a problem, please solve it,please give me solution within 1-2 days.I am a Student,MCA. ie I want to pass... Manoj
Manoj Sahu,CITE,Bangalore
Manoj Sahu,CITE,Bangalore   Hi dear I have a problem, please solve it,please give me solution within 1-2 days.I am a Student,MCA. ie I want to pass... Manoj
Advertisements
J2ME project - Java Beginners
. IT'S VERY URGENT PLEASE........................ thanks manoj kumar
J2ME project - Java Beginners
. IT'S VERY URGENT PLEASE........................ thanks manoj kumar
Facing Problem to insert Multiple Array values in database - JSP-Servlet
Manoj   Hi friend, You Have Problem in Data Table and check
Disabling User Edits in a JTable Component
;Rahul","History","2"},    {"Manoj","
Packing a JTable Component
; {"Rahul","History","2"},   {"Manoj","
Setting the Margin Between Cells in a JTable
;History","2"},    {"Manoj","Biology","
Enabling Row, Column and Cell Selections in a JTable
; {"Rahul","History","2"},   {"Manoj","
Setting Grid Line in JTable
; {"Rahul","History","2"},    {"Manoj"
Remove Unique Column in Database Table
phy NULL 104 manoj che 50 103
Create a Custom Cell Renderer in a JTable
","2"},    {"Manoj","Biology","4"
Setting an Icon with Text in a Column Head of JTable
;,"History","2"},    {"Manoj","Biology"
WEBSERVICE USING APACHE AXIS -TUTORIAL-2 UNDERSTANDING APACHE AXIS
by Manoj Kothale who has written about such templates, which can be found..., which was covered by Manoj Kothale in DeveloperIQ, March ?04 issue &
Testing Struts Application
;demo1.QueryAction name="queryForm" scope=&q scope="session"...---November-2002) 'Understanding Struts Framework' by Manoj Kothale
ALL command - SQL
ALL Command in Java & SQL  Nee all commands in Java.  Dear Manoj, I didn't get u what do u mean by all command. could u please be a bit clear for understanding ur question. Thank u   VARIOUS COMMANDS
Hibernate Many-to-many Relationships
;Author();   manojAuth.setAuthorName("Manoj");   
Advertisements
 

 

 

DMCA.com