Home Answers Viewqa Java-Beginners guys,, need help,, in java programing,, arrays

 
 


sarah joy manimtim
guys,, need help,, in java programing,, arrays
3 Answer(s)      2 years and 3 months ago
Posted in : Java Beginners

create a program where you will input 10 numbers and arrange it in ascending way using arrays.

View Answers

February 17, 2011 at 2:22 PM


Java Input array elements and arrange them in ascending order

import java.util.*;
class ArraySort{
    public static void main(String[] args) {
        Scanner input=new Scanner(System.in);
        System.out.println("Enter Array Elements: ");
        int array[]=new int[10];
        for(int i=0;i<array.length;i++){
            array[i]=input.nextInt();
        }
        System.out.println("Sorted Array:");
        Arrays.sort(array);
        for(int i=0;i<array.length;i++){
            System.out.println(array[i]);
        }
    }
}

February 20, 2011 at 10:03 AM


it didnt work,, it only copy the input numbers and does not in arrange it in ascending way...


May 20, 2011 at 1:44 PM


it did work... I modified the line:

System.out.println(array[i]);

into

System.out.print(array[i]) + " "); so it prints in one line... that way I can see the sorted array better









Related Pages:
guys,, need help,, in java programing,, arrays
guys,, need help,, in java programing,, arrays  create a program where you will input 10 numbers and arrange it in ascending way using arrays
Hey Guys really need to learn - Java Beginners
Hey Guys really need to learn  Im a java beginner and i want to know... u will use scanf(%d%d%d, & month, day, year). How can i do this in java? Someone can help me.. Thank you so much.   Hi Friend, There are lot
Arrays
Arrays   Hi I need help with the following exercises. Exercise 1: Write a Java application in which the user is prompted for the total number... of all the values as well. Exercise 2: Write a Java application in which you
Java programing
Java programing   need help wrting this Write a program that has an array of 5 Strings, and determines which ones are palindromes (letter-case does not matter). thanks
programing
programing  Using Java, Design a simple interface that can capture information of your choice with the following controls; Labels, Text Fields... Hello if anyone can help I would like to know why I get this error when executing
Programing Help - Java Beginners
Programing Help  how to design a filebrowser in java "witout using Swing
Java programing help
Java programing help  Can you help me create this program? Write a console program that repeatedly prompts the user to enter data until they type done (any case, Upper, Lower, or Mixed). As they enter the data, assign
java programing - Java Beginners
;> I need your help about this...   Hi Medinz, Here is my...java programing  Write a program that reads numbers fromthe keyboard into an array of type int[]. You may assume that there will be 50 or fewer
help with substring in c programing
help with substring in c programing  Hi I could not found programming in C in the "select category" so I am posting my question in java section. Please help with substring function,prompt the user for two strings and display
programing question
programing question  how do i use loops(for,while) to add components in java   Hi Friend, The below code might help you. import java.awt.*; import javax.swing.*; class TextFieldArray extends JFrame{ JLabel l[]=new
arrays help - Java Beginners
arrays help  Write a program that sorts values. ? The program includes readIntegers() that o reads the user inputs o stores them in an array, and o returns the array   ? The program includes easySort() that o sorts
SOCKET PROGRAMING IN THE JAVA FOR NETWORKING CONCEPT
SOCKET PROGRAMING IN THE JAVA FOR NETWORKING CONCEPT  I WANT TO KNOW ABOUT THE JAVA SOCKET PROGRAMING FROM BASIC LEVEL AND HOW CAN I WORK ON IT I KNOW THE JAVA PROGRAMING.SO PLEASE HELP ME HOW CAN I DO SOCKET PROGRAMING
programing - IoC
programing  write 4 integers . in that print smalest integer and largest integer  Hi friend, Code to help in solving the problem... and Tutorials on Java visit to : http://www.roseindia.net/java/ Thanks
programing - WebSevices
put  Hi friend, Code to help in solving the problem : import...); } } For read more information,Examples and Tutorials on Java visit to : http://www.roseindia.net/java/ Thanks
Need *Help fixing this - Java Beginners
and maybe add retrieve function //need help with this one badly. Thanks guys for all the help. import java.text.*; import javax.swing.*; import java.awt.event....Need *Help fixing this  I need to make this program prompt user
java arrays
java arrays  i need a java program to store student details like id,name,addr,marks,average,total..using arrays..input data using scanner class and by using class, object and constructor
Need help with this!
Need help with this!  Can anyone please help me... for later use. All the students info is put into arrays, but it is not writing to a file at all at this time. Any help would be greatly appreciated, thank you
Arrays - Java Beginners
Arrays  I need to ask you for one more help with this. pLs Write a program called ThreeArrayLists.java that declares three arrayLists referenced by the objects named priceList, quantityList, and amountList. Each arrayList should
Java with Arrays
Java with Arrays  I was given the assignment to create two parallel arrays; both of size 50 (declares 50 as a constant) One is an array of strings... and store it in the arrays. The input for the problem should be provided in a text
java programing - Java Beginners
java programing  hi!! I Wish i am welcome in this site. As You can see i am trying to teach my self how to program using java language and manually is by not using the function in java language. please help me   
beginning java programing
beginning java programing  Hi. I am trying to write a piece of code that not allow a duplicate item to be added to the list (and allow for either... help me. public void findAndAddFlavor() { //Retrieve the new flavor
arrays
Store a table with students and information (name, ID, password, crypted password, etc) in a multi-dimensional array "stud"  Arrays and Strings... of a table.   help plss anyone
arrays
arrays  using arrays in methods   Java use arrays in methods import java.util.*; class ArrayExample{ public static int getMaxValue(int[] arr){ int maxValue = arr[0]; for(int i=1;i < arr.length;i
I need help in doing this. - Java Beginners
I need help in doing this.  Student DataBase i will need creating..., and the student's GPA.using arrays and objects, need to structure the information as follows:The basic data structures being used will be 2 parallel arrays
Need Help in Java programming
Need Help in Java programming  Hello. Can someone please help me with writing the following program Java program that gives assignment details such as:assignment number,assignment name,due date,submission date,percentage marks
Need help on JAVA JSP
Need help on JAVA JSP  Hi, I have never worked on java and I have... using JAVA JSP). e.g. Tool does not adjust with the resolution of the screen(need to know how I can adjust it based on the cureen system's screen resolution
Arrays
Implement Java code which takes 2 dimensional integer array as input and prints out heaviest island  Implement Java code which takes 2 dimensional integer array as input and prints out heaviest island
Arrays
Arrays  Write a program in java(BlueJ) to store the numbers in single dimensional array(S.D.A)into another S.D.A in reverse order of the location
arrays
arrays  public class Country{ string countryName; string location; int population; double area; } a.write a java statement to create an array of 10 country objects called mycountry using the Country class. b.Assuming
arrays
arrays  can anyone help me out with this two programs plz?? in a main class ,create an array {4,34,5,3,6,8,1} remove 3 and 5th element and shift following left and adding zero at the end of array... another one is to search
Need Help - Java Beginners
Need Help  Hello Sir, Am a beginner of Java. Also i did course... projects in Java as well as J2EE... Can u help me and guide to do a project.../reference/tutorials/ http://netbeans.org/kb/trails/java-ee.html http
need help - Java Beginners
need help  Need help in programming in Java  Simple java program that will show the output within quotes using system.out.println();DISPLAYING OUPUT " * " ," *** " ........I used System.out.print
Need help - Java Beginners
Need help   To Write a Java program that asks the users to enter a m * n matrix of integers, m and n being the number of rows and columns...; Hi Friend, Please try the following code. We hope that this code will help
Need help in java programming
Need help in java programming  Hello. Can someone please help me with writig the following programm. Assignment 20% Presentation 10% Mini Test 10% Exam 60% Java program that accepts the following details: student
need help with a program - Java Beginners
Java algorithm - need help with a program  Java algorithm - need help with a program
intersection of two java arrays
intersection of two java arrays  I am trying to figure out how to compare two arrays and get the intersection and put this into a third array of the correct size. I know how to copy the two arrays into the third array but am
Arrays in java
Arrays in java Arrays are the data structure of java , we use array where we need contiguous memory allocation. Array stores same type of data structure... an array of length 5.  For more details click here : Java Array Tutorial
hello there i need help
i am a beginner, and aside from that i am really eager to learn java please help me with the codes and please explain to me how it works. i only need to use...hello there i need help  : i need to do a program like
Introduction to java arrays
Introduction to java arrays   ... of Arrays in Java Programming language. You will learn how the Array class... arrays. To meet this feature java has provided an Array class which abstracts
need help with a program - Java Beginners
need help with a program   Part I An algorithm describes how... by the user. The output of the program should be the length and width (entered.... First you would need to make up the "test data". For this algorithm, the test data
seriously need help....
seriously need help....  Write a program that will prompt the user to select an appliance, lookup the energy the appliance uses and for each time... program. Use each of the following Java statements at least once in your program
Writing code with multiple Class Methods and String Arrays
In these classes I need to create string arrays that contain artist names, and be able.... I understand I don't have much to offer you guys here but any help would... of music: Rock Choices are: Rolling Stones, Talking Heads, etc. That's all I need
Writing code with multiple Class Methods and String Arrays
In these classes I need to create string arrays that contain artist names, and be able... the decade classes. I understand I don't have much to offer you guys here but any help.... That's all I need it to do but I'm getting stuck on what to put in the main class
arrays - Java Beginners
]; int num; Write Java statements that do the following: a. Call the method... components of the type int.What is stored in list after the following Java code... % 2 == 0) list[i] = list[i] - 3; } THANK YOU GUYS FOR SHARING YOUR
java programing
java programing  reverse a multidigit number using recursive definition
java programing
java programing  write a program to input a number or find & print the highest digit
java programing
java programing  write a program to input a number or find & print the highest digit. example:-2639 than print 9
java programing
java programing  Integers from 0 to X stored in an array of size X+1. Each integer appears once & only once, but in random order e.g. Consider array of size 5 as below... Arr[0]=3; Arr[1]=0; Arr[2]=1; Arr[3]=4; Arr[4]=2
Java Programming Need Help ASAP
Java Programming Need Help ASAP  You are required to develop..., maths mark, communications mark. You will then need accessor and mutator methods... class that creates an array of Students and handles it. You will need

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.