I'm currently getting data from my clipboard in string form using one method however I need to access this information from another method running on a different thread, I've done some research and come across volatile strings but I am not quite sure how to implement them in my code, this is the basics of my code:
public class MobileSite {
public MobileSite(){
Thread thread = new Thread1(() -> {
try {
method1();
} catch (Exception botFailed) {
System.out.println("Bot Failed");
}
});
Thread thread = new Thread2(() -> {
try {
method2();
} catch (Exception botFailed) {
System.out.println("Bot Failed");
}
});
thread1.start();
thread2.start();
method 1 gets the data and method 2 needs to use that data being in string format if anyone has any suggestions they would be much appreciated