| Please give the exact definition of - 1.Polymorphism 2.Package APC book preferred. |  | 
| asked by Harsh Nawal (harsh104) 7 years ago | |
| 2 | |
| Diff between primitive and composite data types |  | 
| asked by Ashvita p (hermiioone_granger) 7 years ago | |
| 1 | |
| All the Best guys! I know most of you like this subject and want to score a century but please don't be overconfident. Make your presentation in the paper as good as possible and I sincerely hope you guys reach your personal goals. - Rahul Bhardwaj, your ResMitr |  | 
| asked by RaBh (rahulbhardwaj2002) 7 years ago | |
| 2 | |
| Guys what is friendly? |  | 
| asked by Atharva45 (arya9591) 7 years ago | |
| 2 | |
| Definition of access modifiers and access specifiers |  | 
| asked by Light yagami (rak_1234) 7 years ago | |
| 1 | |
| /*I don't know why but there is a problem with this code.When I'm entering a number for the value of 'n',and press enter after pressing it, instead of appearing one by one, two input lines appear at once,like:
Enter name 1:
Enter name 2: (Both together,and only one value they accept).
Then, it works properly. I'm forwarding the code, anyone who can help, will be appreciated.*/
import java.util.*;
class BubSortNames
{
    public static void main(String args[])
    {
        Scanner sc=new Scanner(System.in);
        int i,j,n;
        String names[]=new String[100];
        String swap="";
        System.out.println("Enter the value of 'n':");
        n=sc.nextInt();
        System.out.println();
        for(i=0;i<n;i++)
        {
            System.out.println("Enter name "+(i+1)+":");
            names[i]=new String(sc.nextLine());
        }
        //Sorting steps.
        for(i=0;i<n-1;i++)
        {
            for(j=0;j<n-1-i;j++)
            {
                if(names[j].compareTo(names[j+1])>0)
                {
                    swap=names[j];
                    names[j]=names[j+1];
                    names[j+1]=swap;
                }
            }
        }
        //Displaying the sorted list.
        for(i=0;i<n;i++)
        System.out.println(names[i]);
    }//MAIN.
}//CLASS. |  | 
| asked by Aayush Joshi (aayushjoshi) 7 years ago | |
| 0 | |


 
    
 Submitting your question...
 Submitting your question... 



