0

Java help please using eclipse

Can someone help me please this is my assignment for class and I cannot figure out what the issue with my code is. First eclipse wouldn’t run the new code that had no errors, it was running a code I wrote at the beginning of the week. Now my code has errors I did not change anything and I cannot figure it out https://code.sololearn.com/cVp3Yn1ciVTL/?ref=app https://code.sololearn.com/c3Z2i99yUiz9/?ref=app

30th Mar 2022, 2:11 AM
Bautifullife
7 Answers
+ 1
In the SoloLearn Sandbox you cannot have your classes in different files. If you put them together your file runs without error. If you are using this on another environment you did not import the Project1 Class. https://code.sololearn.com/cY2iPvfta4x5
30th Mar 2022, 2:36 AM
William Owens
William Owens - avatar
+ 1
Bautifullife If both classes are in same package like abc Then import Project1 class in Weight class like this: import abc.Project1; Just write this line on the top of the Java class Weight.
30th Mar 2022, 2:52 AM
AÍąJ
AÍąJ - avatar
0
Okay can you help me put them together! Thats what someone said they need to be together and i xant figure that out i google and did this (Right-click on project in package explorer and select Properties. Select "Java Build Path" Select "Link Source" (on the Source tab) Browse "Linked folder location" and select the top folder (containing all your packages etc.) Finish.)
30th Mar 2022, 2:39 AM
Bautifullife
0
Which did not work
30th Mar 2022, 2:39 AM
Bautifullife
0
I am a beginner at all of this so i took the code that William Owens put together of mine and out it into my eclipse and i have an error for public class Project 1 saying it must be defined in its own file and same with public weight how doni fix that?
30th Mar 2022, 2:59 AM
Bautifullife
0
https://www.javatpoint.com/how-to-create-package-in-java Read through this let us know what you need help with to create the user defined package so you can import your class. I'll be out for awhile but someone will help you.
30th Mar 2022, 3:21 AM
William Owens
William Owens - avatar
0
Okay thank you so much! I also have to change my code to accept user input i will post new once inhave completed everything
30th Mar 2022, 3:49 AM
Bautifullife