You are currently viewing a search engine-friendly (archive) version of this page.
View Full Version : Can someone help me with JAVA?
Coffee Pom
December 24, 2000, 03:10 am
I'm having trouble with multidimensional arrays. I understand the regular ones but i just can't get a handle on the multi ones. The book i have (Teach Yourself in 24 hours) gives really tough examples and i don't understand them. I wish they had easier ones.
Could someone post a really really simple example of a multidimensional array so i can look at it and figure it out?
I wrote this program using a one-dimensional array so you can have some idea of where i am.
class Grades3 {
public static void main(String[] arguments) {
int[] studentGrade = { 98, 91, 60, 75, 78, 54, 100 };
int gradeSum = 0;
for (int i = 0; i < studentGrade.length; i++) {
gradeSum = gradeSum + studentGrade[i];
}
int gradeAvg = gradeSum / studentGrade.length;
System.out.println("The average grade for this student is " + gradeAvg);
}
}
I'd like to be able to use multi-dimensional arrays to include different students, etc.
I'm teaching myself JAVA and this is my first big roadblock. Help me out please!! And keep it VERY simple. http://www.helpfromtechs.com/ubb/smilies/smile.gif
Thanks! http://www.helpfromtechs.com/ubb/smilies/smile.gif
------------------
reddsteel
December 24, 2000, 11:22 am
I dont know Java but found some links...
Multidimensional Arrays (http://math.nist.gov/javanumerics/reports/jgfnwg-01.html#arrays)
Multi-Dimensional Arrays [developer.java.sun.com] (http://developer.java.sun.com/developer/onlineTraining/Programming/JDCBook/jnistring.html#multi)
------------------
-- reddsteel
Moderator - HelpFromTechs.com
Applications (http://www.helpfromtechs.com/cgi-bin/ubb/forumdisplay.cgi?action=topics&forum=Applications+(Software)&number=10) & Hardware / Overclocking (http://www.helpfromtechs.com/cgi-bin/ubb/forumdisplay.cgi?action=topics&forum=Hardware+and+Overclocking&number=11) Forums
<FONT COLOR="#800080" SIZE="1" FACE="Verdana, Arial">This message has been edited by reddsteel on December 24, 2000 at 08:22 AM</font>
Coffee Pom
December 24, 2000, 01:46 pm
Reddsteel,
Thanks for the links. I'll check them out!
Merry Christmas!
http://www.helpfromtechs.com/ubb/smilies/smile.gif
------------------
reddsteel
December 24, 2000, 03:01 pm
Your welcome, and Merry Christmas to you also!
(BTW - Is Java worthwhile to learn?)
------------------
-- reddsteel
Moderator - HelpFromTechs.com
Applications (http://www.helpfromtechs.com/cgi-bin/ubb/forumdisplay.cgi?action=topics&forum=Applications+(Software)&number=10) Hardware / Overclocking (http://www.helpfromtechs.com/cgi-bin/ubb/forumdisplay.cgi?action=topics&forum=Hardware+and+Overclocking&number=11) Internet (http://www.helpfromtechs.com/cgi-bin/ubb/forumdisplay.cgi?action=topics&forum=The+Internet&number=7) Forums
Coffee Pom
December 24, 2000, 04:47 pm
I tried those links and they are not really meant for people learning Java for the first time, however i did find what i was looking for elsewhere, so thanks anyway for the help.
I think it's worth learning in my profession. It's easier and more powerful than C++ and it can be used online as well as from the command line. I like it, but each to his own, as they say. http://www.helpfromtechs.com/ubb/smilies/smile.gif
------------------
reddsteel
December 25, 2000, 01:45 pm
Sorry about the links. I defintely understand what you mean. Kind of like the Perl vs. PHP war... =)
------------------
-- reddsteel
Moderator - HelpFromTechs.com
Applications (http://www.helpfromtechs.com/cgi-bin/ubb/forumdisplay.cgi?action=topics&forum=Applications+(Software)&number=10) Hardware / Overclocking (http://www.helpfromtechs.com/cgi-bin/ubb/forumdisplay.cgi?action=topics&forum=Hardware+and+Overclocking&number=11) Internet (http://www.helpfromtechs.com/cgi-bin/ubb/forumdisplay.cgi?action=topics&forum=The+Internet&number=7) Forums
raaj
July 11, 2001, 10:43 am
Well, this can be very simple with this example...
public class MultiDim
{
public static void main(String argv[])
{
int num[][]={{1,2,3,4},
{5,6,7},
{8,9},
{10,11,12,13,14,15,16}};
for(int i=0;i<num.length;i++)
{
for(int j=0;j<num[i].length;j++)
{
System.out.print(num[i][j] + ",");
}
System.out.println("");
}
}
}
------------------
Raaj...
MikeFoster
July 14, 2001, 11:01 am
Hi raaj, welcome to the board!
------------------
Help From Techs Support Forums
vBulletin Copyright © Jelsoft Enterprises Ltd., 2000-2009.