Vcoderz Community
We create websites that have it all, beauty & brains
Lebanon Web Design & Development - Coddict
 

Go Back   Vcoderz Community > Computer Zone > Computers & Information Technologies

Notices

Computers & Information Technologies Everything related to computers and internet.

Reply
 
Share Thread Tools Search this Thread
Old 04-27-2010   #1
7anzala
Registered Member
 
7anzala's Avatar
 
Last Online: 05-15-2012
Join Date: Sep 2006
Posts: 530
Thanks: 9
Thanked 41 Times in 34 Posts
Groans: 0
Groaned at 1 Time in 1 Post
Default Java-Beginer

(a) Create a new class Test_Array that has the following 3 class methods:
(i)
fillArray() takes an integer array as an argument. It allows user to fill-up values in this array by using a for loop and a series of dialog boxes.

public static void fillArray(int[] value)
{
String valueInput;
String length;
length = OUDialog.request("How much Value to store?", "1");
value = new int[Integer.parseInt(length)];
for(int i=0; i<value.length; i++)
{
valueInput=OUDialog.request("Please insert an integer value", "0");
value[i]=Integer.parseInt(valueInput);
}
}



int[] a;
Test_Array.fillArray(a);



when executing the array a is stayed null and is not affected.....

what is mistake? pleeeeeeeeeeeeeeeeeeeeeeease help me


__________________
ALEXANDER Al-Kabeer
Gonna rule you all...
7anzala is offline   Reply With Quote
Old 04-27-2010   #2
Neoxter
Beyond the Code
 
Neoxter's Avatar
 
Last Online: 06-15-2014
Join Date: Sep 2008
Posts: 2,993
Thanks: 2,214
Thanked 3,426 Times in 1,499 Posts
Groans: 57
Groaned at 69 Times in 52 Posts
Default

Grammar Nazis, Do your job.
__________________
Whatever you do, do it for the Lulz.
Neoxter is offline   Reply With Quote
Old 04-28-2010   #3
JouJ
Registered Member
 
JouJ's Avatar
 
Last Online: 04-17-2018
Join Date: Jul 2009
Posts: 15
Thanks: 127
Thanked 10 Times in 6 Posts
Groans: 2
Groaned at 0 Times in 0 Posts
Default

hey 7anzala I'm new to the java language but i tried to see what's the problem in this project I am not familiar with the command you are using for the dialog box(which i think is your problem) but here is my way to wright this project :

The class :

import javax.swing.JOptionPane;

public class Test_Array {


public static void fillArray(int[] value){


String valueInput;

String length;
length = JOptionPane.showInputDialog("how much value to store ?");

value = new int[Integer.parseInt(length)];

for(int i=0; i<value.length; i++)
{
valueInput = JOptionPane.showInputDialog("please insert an integer value");

value[i]=Integer.parseInt(valueInput);

}
for (int i=0;i<value.length;i++){
System.out.println("value ["+i+"] = "+value[i]);
}
}
}


The main class :

public class Main {
public static void main(String[] args) {
int[] a = null ;
Test_Array.fillArray(a);
}
}


PS: the last for loop is to display the affected values in the array.

good luck

hope i helped you .......
JouJ is offline   Reply With Quote
Old 04-28-2010   #4
7anzala
Registered Member
 
7anzala's Avatar
 
Last Online: 05-15-2012
Join Date: Sep 2006
Posts: 530
Thanks: 9
Thanked 41 Times in 34 Posts
Groans: 0
Groaned at 1 Time in 1 Post
Default

mmm yes i made a difference 10x
__________________
ALEXANDER Al-Kabeer
Gonna rule you all...
7anzala is offline   Reply With Quote
Reply

  Vcoderz Community > Computer Zone > Computers & Information Technologies

Tags
javabeginer



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 11:30 AM.


Lebanon web design and development
Powered by vBulletin® Version 3.8.3
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Share