View Full Version : My compiler is not working properly?

07-30-2012, 03:10 AM
Every time I compile a code like this (recently)

class ArrayDemo {
public static void main(String[] args) {
// declares an array of integers length "size"
int[] anArray;
int i = 0;
int size = 10;
anArray = new int[size];

// initialize array
for(i=0; i<size; i++) {
anArray[i] = i*100;

for(i=0; i<size; i++) {
System.out.println("Element at index " + i + ": " + anArray[i]);

it gives me an "Hello World" message box, which I closed a long time ago. Any suggestion?

07-30-2012, 08:49 AM
gives me an "Hello World" message box

well ... i guess there is a POSSIBILITY that it is actually calling a wrong memory address or something, but not likely AT ALL!!! ... restart the computer ? (assuming you are not running linux) and it should fix the problem....

07-30-2012, 10:03 PM
Nope, still flashes an "Hello World"

07-31-2012, 12:41 PM
what IDE are you using? if this were visual studio, it sounds exactly like you have the start project set to the wrong one, so when it does a build, it builds both and then runs the one that is set to run... since your hello-world most likely doesn't call your array demo it is never calling it. I have kept all of my Java projects separate, but I can try to help if you are running eclipse

08-02-2012, 01:44 AM
I am using NetBeans IDE

08-02-2012, 06:43 PM
Yeah I copied and pasted this into eclipse and it gave me the right output... Did you recently make a program that flashed "hello world"? Possibly just delete it if so. I use eclipse so I can't really give you and details on what to do with netbeans though

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum