This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes SiMpLe Program but......I still beginner Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "SiMpLe Program but......I still beginner" Watch "SiMpLe Program but......I still beginner" New topic
Author

SiMpLe Program but......I still beginner

Um Hassan
Greenhorn

Joined: Jun 16, 2009
Posts: 10
Hi everybody,
I have a simple question which Write a method that computes the average, min and max of the values in an array of doubles. The header of the method is as follows:
public static double average(double[] x)
public static double min(double[] x)
public static double max(double[] x) As a beginner java programmer I still have problems in my code.. Could you help me to fetch the true answer.

Code:
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18108
    
  39

Step 1... You need to make sure that your program can compile first. If you can't compile, you can't run. If you can't run, you can't test. If you can't test, you can't figure out what is wrong. If you can't figure out what is wrong, you can't fix.

So... Does the program compile? What issues are you having when you try to compile it?

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36478
    
  16
And when you post a thread, please tell us what the thread is about in its title. And use the code button to make your code easier to read.
Um Hassan
Greenhorn

Joined: Jun 16, 2009
Posts: 10
when I compile the program I saw something isn't expected with {......}. Here you are the compile message.
,Regards


[Thumbnail for compile_error.JPG]

Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18108
    
  39


That's a task list of errors in your program. You need to click each one. The IDE will take you to the error, with icons that explain the error. And you need to fix it.

Showing us the task list is pretty useless -- as we don't get any details about the error.


BTW, for a beginner, it is recommended to not use an IDE. An IDE takes care of tons of stuff, that a beginner needs to learn. I highly recommend that you use the standard javac compiler.

Henry
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 13869
    
  10

Look at lines 6 and 7 of your program:

What are 'b' and 'c'? You haven't declared variables named 'b' and 'c' anywhere, so the compiler doesn't know what you mean there.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: SiMpLe Program but......I still beginner
 
Similar Threads
Exception in thread "main" java.lang.NoClassDefFoundError: kolos/Main
Still unable to call a method
It compiles but only part of it runs.
method question
Counting in Array List/ Standard deviation