Hi,
I have an assignment that needs to use synchronized methods, what I have to do is create a supermarket app in Java where I set a favourite item/product's ID and retrieve it however those two methods need to use synchronized methods. Also I am using a GUI, so how do I implement that into two buttons?
e.g. Set Favourte, Retrieve Favourite?
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) { } private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) { } synchronized public void retrieveFav()throws InterruptedException { } synchronized public void setFav()throws InterruptedException { }