Have you registered yet?
How can i access a variable from a method inside another method?
What exactly are your plans with this local variable from another method?
Can you fill us in about the exact situation you are facing and ideally also a copy of the relevant part of your code?
This is the best solution?
Let’s celebrate the developer career with Java Champions and JUG Leaders!
https://hopin.com/events/dev-career-day-2022/
Have direct access to top developers from many areas, and learn their best tips to get YOUR career growing!
Can you fill us in about the exact situation you are facing and ideally also a copy of the relevant part of your code?
I try to learn build the project from tutorial: https://itsourcecode.com/free-projects/java-projects/vehicle-management-system-project-in-java-with-source-code/
When I run, get error: import com.sun.glass.events.KeyEvent;
Try to solve with this solution (import java.awt.event.KeyEvent;) form:
https://stackoverflow.com/questions/43218019/com-sun-glass-does-not-exist
code: https://itsourcecode.com/wp-content/uploads/2021/07/Vehicle-Management-System-Project-In-Java-Source-Code.zip
Try to run: working. This is the best solution?
This 2022 Vehicle Management System Project In Java was developed in JAVA Programming using NetBeans IDE, It also includes a free source code.
I try to learn build the project from tutorial: https://itsourcecode.com/free-projects/java-projects/vehicle-management-system-project-in-java-with-source-code/
When I run, get error: import com.sun.glass.events.KeyEvent;
Try to solve with this solution (import java.awt.event.KeyEvent;) form:
https://stackoverflow.com/questions/43218019/com-sun-glass-does-not-exist
code: https://itsourcecode.com/wp-content/uploads/2021/07/Vehicle-Management-System-Project-In-Java-Source-Code.zip
Try to run: working. This is the best solution?
I hardly recommend to use
import java.awt.event.KeyEvent;
Exactly like it is recommended on stackoverflow: https://stackoverflow.com/a/43218233
If it not work. Then the code needs professional refactoring.
Who ever implemented it by using com.sun.glass.event.KeyEvent did a unprofessional mistake.
I have a project that is on github. I have two different computers that use the project. The reason I mention github is because the two computers have the exact same project. But on one of the comp…
I wonder if somebody could enlighten me on how can I prevent a parameter of a Class to accept negative values.
The idea I came up with was as follows in 2nd and 3rd attributes:
public Estoque(String nome, int qtdAtual, int qtdMinima) { //constructor
this.nome = nome;
this.qtdAtual = qtdAtual < 0 ? 0 : qtdAtual;
this.qtdMinima = qtdMinima < 0 ? 0 : qtdMinima;
}
I wonder if that’s the most efficient solution. In case not, I’d be really appreciated to know.
in this case it is better, to throw an exception. The user of the class will have no feedback, that his value was set to 0 and might assume, that it still is his negative value.
Therefore, you could use the guava library (https://guava.dev/releases/19.0/api/docs/com/google/common/base/Preconditions.html), which already has many cases covered, like Preconditions.checkNotNull(…)
in this case it is better, to throw an exception. The user of the class will have no feedback, that his value was set to 0 and might assume, that it still is his negative value.
Therefore, you could use the guava library (https://guava.dev/releases/19.0/api/docs/com/google/common/base/Preconditions.html), which already has many cases covered, like Preconditions.checkNotNull(…)
I’d suggest the same thing, throwing an exception gives you more feedback and you can act directly on the undesired condition.
in this case it is better, to throw an exception. The user of the class will have no feedback, that his value was set to 0 and might assume, that it still is his negative value.
Therefore, you could use the guava library (https://guava.dev/releases/19.0/api/docs/com/google/common/base/Preconditions.html), which already has many cases covered, like Preconditions.checkNotNull(…)
Here the most recent api doc of Preconditions: https://guava.dev/releases/31.1-jre/api/docs/com/google/common/base/Preconditions.html
public static double sqrt(double value) {
checkArgument(value >= 0, “input is negative: %s”, value);
// calculate square root
}
I try to learn build the project from tutorial: https://itsourcecode.com/free-projects/java-projects/vehicle-management-system-project-in-java-with-source-code/
When I run, get error: import com.sun.glass.events.KeyEvent;
Try to solve with this solution (import java.awt.event.KeyEvent;) form:
https://stackoverflow.com/questions/43218019/com-sun-glass-does-not-exist
code: https://itsourcecode.com/wp-content/uploads/2021/07/Vehicle-Management-System-Project-In-Java-Source-Code.zip
Try to run: working. This is the best solution?
‼️
I just downloaded the source code because I was suspicious about the quality after having a glance over the article. I am shocked how unprofessional the source code is…. Please don’t take it as an example of what good quality source code looks like.
There are multiple aspects which are designed badly. I would rather consider this source code as a good starting point, for practicing refactoring.
link to source code: https://itsourcecode.com/wp-content/uploads/2021/07/Vehicle-Management-System-Project-In-Java-Source-Code.zip
I just downloaded the source code because I was suspicious about the quality after having a glance over the article. I am shocked how unprofessional the source code is…. Please don’t take it as an example of what good quality source code looks like.
There are multiple aspects which are designed badly. I would rather consider this source code as a good starting point, for practicing refactoring.
link to source code: https://itsourcecode.com/wp-content/uploads/2021/07/Vehicle-Management-System-Project-In-Java-Source-Code.zip
I’d rather not look at it.
I just downloaded the source code because I was suspicious about the quality after having a glance over the article. I am shocked how unprofessional the source code is…. Please don’t take it as an example of what good quality source code looks like.
There are multiple aspects which are designed badly. I would rather consider this source code as a good starting point, for practicing refactoring.
link to source code: https://itsourcecode.com/wp-content/uploads/2021/07/Vehicle-Management-System-Project-In-Java-Source-Code.zip
thanks for your recommendation 👍