Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New Coder
    Join Date
    Jul 2012
    Location
    NYC
    Posts
    23
    Thanks
    1
    Thanked 0 Times in 0 Posts

    My compiler is not working properly?

    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?
    Last edited by dannyboi; 07-30-2012 at 03:13 AM.

  • #2
    New to the CF scene
    Join Date
    Jul 2012
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by dannyboi View Post
    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....
    Last edited by WA; 07-30-2012 at 06:42 PM.

  • #3
    New Coder
    Join Date
    Jul 2012
    Location
    NYC
    Posts
    23
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Nope, still flashes an "Hello World"

  • #4
    Senior Coder alykins's Avatar
    Join Date
    Apr 2011
    Posts
    1,753
    Thanks
    41
    Thanked 191 Times in 190 Posts
    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

    I code C hash-tag .Net
    Reference: W3C W3CWiki .Net Lib
    Validate: html CSS
    Debug: Chrome FireFox IE

  • #5
    New Coder
    Join Date
    Jul 2012
    Location
    NYC
    Posts
    23
    Thanks
    1
    Thanked 0 Times in 0 Posts
    I am using NetBeans IDE

  • #6
    New Coder
    Join Date
    Jun 2012
    Posts
    15
    Thanks
    0
    Thanked 3 Times in 3 Posts
    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


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •