Forum Stats

  • 3,825,998 Users
  • 2,260,586 Discussions
  • 7,896,760 Comments

Discussions

NetBeans and Lab4 odd behaviour

OTG-467455
OTG-467455 Member Posts: 506 Bronze Badge
edited Dec 2, 2017 7:19AM in Java Puzzle Ball

Two observations I have made are:

  1. If I open Lab4 then import Lab4_Soln and wish to compile Lab4, NetBeans keeps on indicating Lab4_Soln.
    1. Closing Lab4_Soln does not help
    2. What else should be closed or done to get to compile and run the project of your choice

           pastedImage_12.png

  1. Java seems to have a peculiar way of working with numbers, does this have anything to do with the Octal number system it is using.
    1. There are two accounts that have a balance greater than or equal to 20000
    2. The test for greater than or equal to fails on this statement.   ".filter(a -> a.getBalance() >= 20000)"
    3. Account #2 Jessica has a balance of 50000 and account # 1 Damien has a balance of exactly 20000
    4. Walking through the code a bonus should be deposited into both accounts.
    5. Tested this one again and it works now.  Initially it would only deposit a bonus into account # 2

Best Answer

  • NickR2600-Oracle
    NickR2600-Oracle Member Posts: 530 Employee
    edited Dec 1, 2017 7:01PM Answer ✓

    1.  I think I know what happened.  I wrote the Soln project first, copied and renamed the project to create the start state, and then removed certain lines of code.  I think something went wrong with the renaming process where NetBeans isn't completely refactoring the name of the original project.  That information is kept somewhere within a couple metadata files NetBeans produces, but I'm not able to pinpoint the exact files.

    The same thing happens on my machine. I think NetBeans really is running the non-Soln version because the program has the same functionality (for example, I'm unable to make a withdrawal).  But it's just calling the program the wrong thing.

    OTG-467455

Answers

  • NickR2600-Oracle
    NickR2600-Oracle Member Posts: 530 Employee
    edited Dec 1, 2017 7:01PM Answer ✓

    1.  I think I know what happened.  I wrote the Soln project first, copied and renamed the project to create the start state, and then removed certain lines of code.  I think something went wrong with the renaming process where NetBeans isn't completely refactoring the name of the original project.  That information is kept somewhere within a couple metadata files NetBeans produces, but I'm not able to pinpoint the exact files.

    The same thing happens on my machine. I think NetBeans really is running the non-Soln version because the program has the same functionality (for example, I'm unable to make a withdrawal).  But it's just calling the program the wrong thing.

    OTG-467455
  • NickR2600-Oracle
    NickR2600-Oracle Member Posts: 530 Employee
    edited Dec 1, 2017 7:20PM

    2.  I think if it had to do with an Octal system, the results would at least seem consistent and follow some sort of rule set.  You can force a number to be an number to be an Octal by placing a 0 before it.  010 is consistently 8, for example. Here's my experiment in Java 9's JShell:

    pastedImage_0.png

    In the case of the lab, I'm not sure what could be going on.  Perhaps some weird concurrency issue?

    OTG-467455