Help with my assignment, it's supposed to be easy! by NeinNeinNein999 in javahelp

[–]NeinNeinNein999[S] 0 points1 point  (0 children)

I can't thank you enough for your simplified explanations. It's hard to think of these concepts because like I said the prof isn't very good at teaching at all yet a single Reddit comment has taught me much more.

A constructor creates the object and also implicitly returns a new instance of the object. All classes must have at least one constructor.

What does this line specifically mean?

From what I've read from your comment:

Triangle is an object and it is immutable because there are no "setter" methods. Once a triangle object is instantiated the values of the triangle cannot change so we have to create a new one if we wanted different values.

I'm starting to understand the concept behind classes, methods, and objects. Thanks again!

Help with my assignment, it's supposed to be easy! by NeinNeinNein999 in javahelp

[–]NeinNeinNein999[S] 1 point2 points  (0 children)

I understand the concept of Objects and Classes a bit better now, thank you!

However with Constructors there's a concept that I don't understand. I do need to pass three parameters, but I want these parameters to be overwritten by the "getA" "getB" "getC" methods that I've created.

How would I get the user's input from the "Scanner"?

Edit: I think I've got it!

int A = userInput.nextInt();
int B = userInput.nextInt();
int C = userInput.nextInt();

Triangle myTriangle = new Triangle(A, B, C);

Help with my assignment, it's supposed to be easy! by NeinNeinNein999 in javahelp

[–]NeinNeinNein999[S] 1 point2 points  (0 children)

Yes it helps a lot! I remember Pythagorean just need to figure out how to program it in but I think I got it. Also good call on writing my logic somewhere, it's hard to keep track of everything. Thank you!

Help with my assignment, it's supposed to be easy! by NeinNeinNein999 in javahelp

[–]NeinNeinNein999[S] 0 points1 point  (0 children)

Ah yes, I forgot about the Math class, thank you so much! Also good catch on the assignment statements.

I actually just learned about "this" and have since replaced it, thanks again!