File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes It compiles but only part of it runs. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "It compiles but only part of it runs." Watch "It compiles but only part of it runs." New topic

It compiles but only part of it runs.

Paul Roberts

Joined: Sep 26, 2011
Posts: 11
As a total beginner I'm working through a long tutorial. I've decided that I won't move onto the next topic until I understand the

code in the current topic and have seen it run. I have merged two pieces of code from the tutorial. The main method calculates and

prints the number of occurrences of randomly generated numbers from 0 to 9. This part works. However additional code which is

meant to identity largest and smallest elements doesn't seem to do anything. There are no errors when I compile.

If someone would point out why static void printLargestAndSmallestElements (int[] n) { doesn't work in this instance I would be


Sorry I haven't highlighted the relevant code. When I try to use the features on this page it just prints text.

[Edit - added code tags - MB]
Matthew Brown

Joined: Apr 06, 2010
Posts: 4544

If that's the complete code you're using...the reason printLargestAndSmallestElements doesn't do anything is that you don't actually call it anywhere.
I agree. Here's the link:
subject: It compiles but only part of it runs.
It's not a secret anymore!