What is the `Thread.setPriority()` method used for in Java?
`Thread.setPriority()` allows you to set the order in which threads will finish executing, ensuring that higher-priority threads always finish first.
Thatâ€™s incorrect. While higher-priority threads are given preference, it doesnâ€™t guarantee that they will finish first, as scheduling is also influenced by other factors.
Can you describe how thread priorities affect scheduling in a multithreaded environment?