You can use b.length to find out how many characters there are. This is only the number of characters, not indexing, so if you iterate over it with a for loop, remember to...
  • April 4, 2022
  • 0 Comments
You have added the JPanel over the JFrame which completely blocks out the underlying container on which you have set the color. You could do this instead: public Gui(String title) { super(title); JPanel...
  • April 4, 2022
  • 0 Comments
Some Notes: 1- in.nextInt(); reads an integer from the user, blocks until the user enters an integer into the console and presses ENTER. The result integer has to be saved in order...
  • April 4, 2022
  • 0 Comments
The immediate problem is due to you using <= temp.length() instead of < temp.length(). However, you can achieve this a lot more simply. Even if you use the string approach, you can...
  • April 4, 2022
  • 0 Comments
One rule-of-thumb: ask yourself “Does it make sense to call this method, even if no object has been constructed yet?” If so, it should definitely be static. So in...
  • April 4, 2022
  • 0 Comments
Sergio: You should use BLOB. It is pretty straighforward with JDBC. The problem with the second code you posted is the encoding. You should additionally encode the bytes to make...
  • April 4, 2022
  • 0 Comments
You can’t set the precision of a double (or Double) to a specified number of decimal digits, because floating-point values don’t have decimal digits. They have binary digits. You...
  • April 4, 2022
  • 0 Comments