4 Replies - 636 Views - Last Post: 24 October 2015 - 01:34 PM Rate Topic: -----

#1 lorenestes   User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 20
  • Joined: 25-September 15

eclipse produces desired output, netBeans does not...

Posted 24 October 2015 - 09:58 AM

Hello everyone,

I have entered the exact same code into Eclipse and netBeans. When I run the Eclipse, I get the desired output. When I run the netBeans, I get nothing. I attached a screenshot from each...

What is going on? How do I get netBeans to display the output?

Thanks for looking at my question,

Loren

Attached image(s)

  • Attached Image
  • Attached Image

Is This A Good Question/Topic? 0
  • +

Replies To: eclipse produces desired output, netBeans does not...

#2 NormR   User is offline

  • D.I.C Lover
  • member icon

Reputation: 870
  • View blog
  • Posts: 6,695
  • Joined: 25-December 13

Re: eclipse produces desired output, netBeans does not...

Posted 24 October 2015 - 10:30 AM

Could you copy and paste here in the thread the code from each of the IDEs so we can copy them for testing?
Be sure to wrap the code in code tags See [CODE] button above.
Was This Post Helpful? 0
  • +
  • -

#3 lorenestes   User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 20
  • Joined: 25-September 15

Re: eclipse produces desired output, netBeans does not...

Posted 24 October 2015 - 10:37 AM

Sure! The reason I didn't initially is because I thought the code was fine and it was an issue with some setting on netBeans, which I am brand new to. Also, because of the multiple classes. Also, when I had this problem in netBeans, I directly copied and pasted into Eclipse and it worked fine...Anyway, here is the code, for what it's worth:

public class League {
    public static void main(String[] args) {
        Player player1=new Player();
        Player player2=new Player();
        Player player3=new Player();
        player1.playerName="George Elliot";
        player2.playerName="Graham Greene";
        player3.playerName="Geoffrey Chaucer";
        
        Player[] thePlayers={player1, player2, player3};
        
        Team team1=new Team();
        team1.teamName="The Greens";
        team1.playerArray=thePlayers;
        
        for(Player thePlayer: team1.playerArray){
            System.out.println(thePlayer.playerName);
        }
        
   
    }
    
}


public class Player {
    public String playerName;
}


public class Team {
    public String teamName;
    public Player[] playerArray;
}


This post has been edited by lorenestes: 24 October 2015 - 10:38 AM

Was This Post Helpful? 0
  • +
  • -

#4 NormR   User is offline

  • D.I.C Lover
  • member icon

Reputation: 870
  • View blog
  • Posts: 6,695
  • Joined: 25-December 13

Re: eclipse produces desired output, netBeans does not...

Posted 24 October 2015 - 10:48 AM

Which IDE is that code from?
Is it the one that works or the one that does not work?

I use the javac and java commands and the code printed out 3 lines for me.

If the code is identical, the problem must be with how you set up the IDE.

This post has been edited by NormR: 24 October 2015 - 10:49 AM

Was This Post Helpful? 0
  • +
  • -

#5 lorenestes   User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 20
  • Joined: 25-September 15

Re: eclipse produces desired output, netBeans does not...

Posted 24 October 2015 - 01:34 PM

Thank you.

Yes, I too had no problem at all using this identical code from netBeans in Eclipse, which is why I suspect it has to do with some setting on netBeans. I am hoping someone who is very familiar with netBeans will immediately recognize the problem.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1