YoungMoneyMitch
YoungMoneyMitch
JCHJava Community | Help. Code. Learn.
Created by AyoWut? on 10/6/2024 in #java-help
Creating an object of an entire class?
When you say run through the whole class what do you mean? An object has member variables (these exist in the context of the whole object) and methods. Methods are how other objects can interact with your object, if there is logic that you want the service to do it will have to be executed through a method. Methods take parameters which look like yourObjectName.methodName(parameter1, parameter2). Lets say you have a class that does a lot of different things and you have one method that does something simple like add. when you want to run that method you only need to call the method with the necessary inputs like yourObjectName.methodName(number1, number2) and that will be fine. BUT the yourObjectName object has to be created at some point (unless it is static). If your method is not static, Java assumes that the method related to the object itself. It cannot know what you may or may not need from the object as a whole, in fact it assumes you will need that stuff if it is not marked as static. So if you have a Service class that does something, you will need to make sure the service is created using an appropriate constructor (the thing that makes the object at runtime) That is probably why it is asking for things that aren't directly related. Does taht help at all? The flow is like this create object -> use object methods -> methods are pieces of code that DO something
13 replies
JCHJava Community | Help. Code. Learn.
Created by AyoWut? on 10/6/2024 in #java-help
Creating an object of an entire class?
That’s fair. I’d say it’s also important to remember every object is an object of an entire class! Services ‘process’ other objects but both service classes and model classes are objects at runtime (unless static)
13 replies
JCHJava Community | Help. Code. Learn.
Created by AyoWut? on 10/6/2024 in #java-help
Creating an object of an entire class?
Hey! Are you familiar with Spring? The pattern I see most often is to use @AllArgsConstructor which will generate a constructor that takes in the necessary objects (beans in spring)
13 replies
JCHJava Community | Help. Code. Learn.
Created by San4ik on 10/5/2024 in #java-help
java class renamer
Why not proguard?
5 replies
JCHJava Community | Help. Code. Learn.
Created by DigitalDynamo on 3/7/2024 in #java-help
API Connection :
Other people can be helpful but they will never have as much context as the stacktrace
7 replies
JCHJava Community | Help. Code. Learn.
Created by DigitalDynamo on 3/7/2024 in #java-help
API Connection :
Bröther the stacktrace tells you. You cut off the reason (after ‘because’)
7 replies