The above code should be in a file called "Amicable.java". To compile, type "javac Amicable.java". This should create a file called "Amicable.class". To run it, type "java Amicable".
Is that what you are doing?
VernonDozier
Posting Expert
5,527 posts since Jan 2008
Reputation Points: 2,633
Solved Threads: 711
I want to run it in netbeans, to see if I get the result I want.
Still needs to be in a file called "Amicable.java" if it is not already. If it's in NetBeans, you can ignore the rest of my earlier post.
VernonDozier
Posting Expert
5,527 posts since Jan 2008
Reputation Points: 2,633
Solved Threads: 711
And how do I do that?
First time using netbeans and coding in java lang.
I right clicked on the project name and changed it to Amicable.java and the output folder, that didn't help...
Don't change the project name. You can name the project whatever you'd like. You have a couple of options.
You can go into the src folder for the project and rename the file to Amicable.java manually there (not through NetBeans).
NetBeans may let your "refactor" the name to the correct name by right-clicking the file (though I've never tried it where it was a matter of not having the .java extension at the end).
Delete the file and create a new CLASS (not a new project) called Amicable. NetBeans will add the .java extension automatically. Then copy and paste the code into the new file.
So it's a matter of finding out what the file name is now and seeingDoes it end in .java?
Is the part before the dot "Amicable"?
VernonDozier
Posting Expert
5,527 posts since Jan 2008
Reputation Points: 2,633
Solved Threads: 711