Home Answers Viewqa Java-Beginners Java using arrays

 
 


Gothic Gurl
Java using arrays
1 Answer(s)      4 years and 3 months ago
Posted in : Java Beginners

View Answers

March 9, 2009 at 2:03 AM


Hi friend,


Code to help in solving the problem :

import java.io.*;

import java.util.Arrays;
class NumberAr
{
public static void main(String[] args) throws Exception
{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int ar[] = new int[10];
System.out.println("Enter Ten Numbers");
int count=1;
for(int i=0;i<10;i++)
{
System.out.println("Enter "+count+" Number");
ar[i] = Integer.parseInt(br.readLine());
count++;
}

System.out.println("Display all the numbers");
int sum=0;
int avg=0;
for(int i=0;i<10;i++)
{
sum+=ar[i];
System.out.println("Array ar["+i+"] " + ar[i] );

}
avg=sum/10;

Arrays.sort(ar);
System.out.println("Sorting numbers");
for(int i=0;i<10;i++)
{
System.out.println("Array ar["+i+"] " + ar[i] );

}

System.out.println("Max value of Ar " + ar[9] );
System.out.println("Average value of Ar " + avg );


}
}


Thanks









Related Pages:
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
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
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
java; arrays - Java Beginners
java arrays example  How can you create a program, by using arrays and the output would be X. by using char or string.Thank you
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
arrays
arrays  Write a program to print details of all the months with number of days in a year (Leap or Non Leap year) using array of objects Integer and String
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
as well. Read a set of 10 correct answers,using a JOptionPane dialog box and store... The class average is : Using the array of student records ,display a list for all
how to compare 2 arrays using java?
how to compare 2 arrays using java?  hi can anyone give me the information regarding comparision of arrays.   Java Compare Arrays
Java using arrays - Java Beginners
Java using arrays  Write a program to input a possibly integer n(n<=10);followed by n real values into an array a of size n and the program must perform the following: Display back the values input Sort the values
arrays help - Java Beginners
arrays help  Write a program that sorts values. ? The program...() ? The program reads the user inputs by using readIntegers(), sorts the input values by using easySort(), and prints the sorted values
Arrays - Java Beginners
square) using java and I would like to separate the coumns using the pipe symbol and the rows using the hyphen symbol. How do I go about it? The generated numbers...://www.roseindia.net/java
Arrays - Java Beginners
to enter each of the integers using a for-loop. Once entered, the program should output the content of the array to a file called ?data.txt? using a while-loop. I
Arrays
Java NotesArrays Java arrays are similar to ideas in mathematics An array...++, which had a good reason for using zero (pointer arithmetic on arrays... arrays Java 2 added anonymous arrays, which allow you to create a new array
arrays - Java Beginners
and the smallest values by using the above three methods. ? The program prints the largest
arrays - Java Beginners
that instantiates a dependent using the provided names and the this reference for the third
Arrays in java
Arrays in java  what is param array in java
Comparing Arrays
Comparing Arrays : Java Util       This section show you how to determine the given arrays... or not. This comparison operation is performed by using the equals() method of Arrays
ARRAYS SORTING - Java Interview Questions
ARRAYS SORTING  How To Sort An Array With Out Using Sort Method ?I Want Code?  Hi, Here is the code in java. You can find both Ascending and Descending order code. Ascending order is commented. public class
About Java arrays - Java Beginners
About Java arrays  Hello.........My question is can we create a two dimensional matrix using only one for loop
arrays part 2 - Java Beginners
arrays part 2  Question 2: Useful Array Algorithms and Operations (5... by using the above method. ? The program reads another integer from the user. ? The program searches the value in the integer array by using the above method
java arrays
java arrays  can i know how can we intilize the three dimentional arrays in java? and how can we assign thae values to that array
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
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 arrays
java arrays  how do you write the code for multipliying 2 double arrays to be in a 3rd double array? here is my code: package employeepay; /** * * @author Owner */ public class Main { /** * @param args the command line
Java Arrays Tutorial
Java Arrays Tutorial       Learn Java Arrays from scratch with ease... download. Introduction to Java Arrays In this section you
java arrays
java arrays  Suppose that you are required to store information about students for the module Data structures and Algorithms. The information for each student consists of the studentââ?¬â?¢s ID number, surname, other names
Implementing ArrayList's functionalities into arrays - Java Beginners
....ARRAYS! I've already tried to solve it using Arraylists and faced no problems... to organize data into arrays and MOST OF ALL how to do the same things that ArrayList
arrays in java - Java Beginners
arrays in java  Hi All, I have two arrays. in this two array some name are same. I want to merge those arrays into single. But while merging I want to delete duplicate entries. How merge those arrays. Thanks, mln15584
multidimensional arrays
multidimensional arrays  Write a javascript code for inputting numbers and displaying that using multidimensional arrrays.   Hello Friend, Try this: <script> function multidimensionalArray(array
Arrays in java 7
This tutorial describes the concept of Arrays in java 7
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
reverse arrays in java
reverse arrays in java  how do i make a code that can be used to reverse the elements of an array in two dimension such that the last element of an array becomes the first element of the array and the first element of an array
reverse arrays in java
reverse arrays in java  how do i write a program in array of size n*m where both n and m are greater than 20 such that the 1st element of an array becomes the last and vice verse
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
Passing Arrays In Jsp Methods
arrays are most commonly used arrays in java. JSP is a technology which enables us...Passing Arrays In Jsp Methods   ... data type. It is one of  the simplest data structures. Arrays holds equally
Java Arrays Tutorials
(). Browse the following code to Learn Java Arrays in detail...The java.util.Arrays class helps the programmers to manipulating the arrays. It provides the methods to easily manipulate the arrays. Methods provided
Are arrays primitive data types?
Are arrays primitive data types?   Hi, Are arrays primitive data types? thanks   Hi, In Java, Arrays are objects. Identifier are some... stored by identifier is defined by the special java keyword is termed
Arrays - Java Interview Questions
a program that take arrays A & B as input and find missing element in B array
java 2d arrays
java 2d arrays  Create a program that will: a) Create the array and populate it with the given values. 9, 8 2, 17 49, 4 13, 119 2, 19 11, 47.... and if i do it manualy it is wrong. public class Arrays { public static void main
arrays - Java Interview Questions
a program that take arrays A & B as input and find missing element in B array
Iterating java arrays
Iterating java Arrays arrays can be iterated by the for, for each loop. array elements can be added to the list and then it can be iterated by the iterator() method. Example 1 public class
reverse two dimensional arrays in java
reverse two dimensional arrays in java  reverse array elements in two dimensional array such that the last element becomes the first
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
Java Method with arrays
Java Method with arrays  My assignment is to write a java method, smallestIndex, that takes as its parameters an int array and its size, and returns the index of the (first occurrence of the) smallest element in the array. Also
ARRAYS - Java Beginners
the following link: http://www.roseindia.net/tutorial/java/core/assignSeats.html
Arrays - Java Beginners
(); } } } --------------------------------------------- Read for more information. http://www.roseindia.net/java

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.