Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Oct 20th, 2004, 1:33 AM   #1
stegamann
Newbie
 
Join Date: Oct 2004
Posts: 2
Rep Power: 0 stegamann is on a distinguished road
hey,
im very new to programming, and though im not an idiot, feel free to treat me like one.
so i have an assignment in which i have to read a series of doubles, print them, sort them and print the sorted array, all in different methods.
so im pretty sure i could do it in the main, but when i try to return an array from the service method to the main. im getting an error that says .class expected. well i guess i should post the bit.
double[] series = new double[100];
int index=0;
System.out.println("Please input a series of numbers. "+"Input -888 when you are done.");
double y = SavitchIn.readDouble();
while (y != -888)
{
series[index]=y;
index++;
y=SavitchIn.readDouble();
}
return series[];
so if i try to compile that, i get...
Service.java:23: '.class' expected
        return series[];
                  ^
1 error
anyone have any clue what im doing wrong?
i know it seems like nothing but it would be a big help to me. thanks.

(EDITED (SykkN): fixed your [ CODE ] tags ...)
stegamann is offline   Reply With Quote
Old Oct 20th, 2004, 7:46 AM   #2
Mjordan2nd
The Supreme Ruler
 
Join Date: May 2004
Location: Houston
Posts: 1,476
Rep Power: 6 Mjordan2nd is on a distinguished road
Could you post the whole thing?
__________________
"Every gun that is made, every warship launched, every rocket signifies, in the final sense, a theft from those who hunger and are not fed, from those who are cold and are not clothed. The world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children." - Dwight D. Eisenhower
Mjordan2nd is offline   Reply With Quote
Old Oct 20th, 2004, 7:57 AM   #3
stegamann
Newbie
 
Join Date: Oct 2004
Posts: 2
Rep Power: 0 stegamann is on a distinguished road
Here is the whole service method.
this is what is giving me the error.
public class Service
{
public static char convert(char letter)
{
int x;
x =(int)letter +32;
letter=(char)x;
return letter;
}

public double[] read()
{
double[] series = new double[100];
int index=0;
System.out.println("Please input a series of numbers. "+"Input -888 when you are done.");
double y = SavitchIn.readDouble();
while (y != -888)
{
series[index]=y;
index++;
y=SavitchIn.readDouble();
}
return series[];
}
}

thanks


(EDITED (SykkN): same thing here ...)
stegamann is offline   Reply With Quote
Old Oct 21st, 2004, 3:24 PM   #4
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
I'm no Java coder, but one piece of advice: don't but spaces within the [code] tags.
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 1:32 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC